Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0RC6

Bug #13100 parser gets hung
Submitted: 2008-02-11 14:11 UTC
From: alexis Assigned:
Status: Open Package: Structures_BibTex (version 1.0.0RC4)
PHP Version: 5.2.0 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 50 + 33 = ?

 
 [2008-02-11 14:11 UTC] alexis (Alexis Registrationsarelame)
Description: ------------ The file-parsing code does not handle strings properly, and gets confused when @ signs appear in strings (as in \latex@macro). The test below is distilled from my preamble. Frankly, parse() and parseEntry() are a terrible mess and should be refactored into a state machine that distinguishes top-level, in-entry and in-string states. The first embedded @ in the test triggers a warning TWICE, then the second gets stuck in the loop... Test script: --------------- cat > example.php @PREAMBLE{ "{@url} @..." } ^D Expected result: ---------------- The code should terminate Actual result: -------------- infinite loop

Comments

 [2008-05-18 14:16 UTC] olenz (Olaf Lenz)
I can confirm the bug in handling the '@' sign in entries. I came across the problem, when I had an entry that contained a '@' in an entry. The result was a crash when the memory of PHP was exhausted. My workaround was to comment out the lines in the beginning of the "parser" function that starts with if ((0 != $open) && ('@' == $char)) Otherwise, I agree with alexis, that the code is hard to read. Instead of transforming the code to a state machine, it might be more rewarding to directly use a parser generator (like http://pear.php.net/package/PHP_ParserGenerator) to generate the parser. Best regards Olaf