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

Bug #16477 Infinite loop in the parser when a comma is missing
Submitted: 2009-07-28 05:50 UTC
From: arnoques Assigned:
Status: Open Package: Structures_BibTex (version CVS)
PHP Version: 5.1.2 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 - 37 = ?

 
 [2009-07-28 05:50 UTC] arnoques (arnoques arnoques)
Description: ------------ The parser also gets into an infinite loop when processing an entry like this: @ARTICLE{key, author = {LastName, Name} title = {a title}, journal = {a journal} } It gets confused because the parser searches for titles between a ',' and a '=', so it believes that "Name}\n\ttitle" is the name of the field. The infinite loop is triggered in the while loop at lines 383-393, when the parser assumes that, since the braces are not balanced in "= {LastName," there must be a previous "=". If there's no comma inside the author field, the program still gets confused but it doesn't trigger the infinite loop. I agree with the submitter of a previous bug that the parser needs a serious rewrite. It should accept and reject the same inputs that the original bibtex program does. Test script: --------------- Run the script on the previous entry require_once 'BibTex.php'; $bibtex = new Structures_BibTex(); $ret = $bibtex->loadFile('test.bib'); $bibtex->parse(); print_r($bibtex->warnings); Expected result: ---------------- An error stating that there is a missing comma (and several warning due to missing fields, but I know that's not yet implemented). The output of bibtex is ~$ bibtex test This is BibTeX, Version 0.99c (Web2C 7.5.4) The top-level auxiliary file: test.aux The style file: plain.bst Database file #1: test.bib I was expecting a `,' or a `}'---line 3 of file test.bib : : title = {a title}, (Error may have been on previous line) I'm skipping whatever remains of this entry Warning--empty title in key Warning--empty journal in key Warning--empty year in key (There was 1 error message) Actual result: -------------- Infinite loop at lines 383-393

Comments