cvs: pear /Structures_BibTex BibTex.php BibTexTest.php

From: Date: Tue, 14 Nov 2006 20:03:15 +0000
Subject: cvs: pear /Structures_BibTex BibTex.php BibTexTest.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-43080@lists.php.net to get a copy of this message
hugoki Tue Nov 14 20:03:15 2006 UTC Modified files: /pear/Structures_BibTex BibTex.php BibTexTest.php Log: - Bug hunting: now also a warning is generated when the very last entry has a missing closing brace http://cvs.php.net/viewvc.cgi/pear/Structures_BibTex/BibTex.php?r1=1.10&r2=1.11&diff_format=u Index: pear/Structures_BibTex/BibTex.php diff -u pear/Structures_BibTex/BibTex.php:1.10 pear/Structures_BibTex/BibTex.php:1.11 --- pear/Structures_BibTex/BibTex.php:1.10 Thu Nov 2 20:25:01 2006 +++ pear/Structures_BibTex/BibTex.php Tue Nov 14 20:03:14 2006 @@ -19,7 +19,7 @@ * @author Elmar Pitschke <elmar.pitschke@gmx.de> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: BibTex.php,v 1.10 2006/11/02 20:25:01 hugoki Exp $ + * @version CVS: $Id: BibTex.php,v 1.11 2006/11/14 20:03:14 hugoki Exp $ * @link http://pear.php.net/package/Structures_BibTex */ @@ -280,6 +280,17 @@ } $lastchar = $char; } + //If open is one it may be possible that the last ending brace is missing + if (1 == $open) { + $entrydata = $this->_parseEntry($buffer); + if (!$entrydata) { + $valid = false; + } else { + $this->data[] = $entrydata; + $buffer = ''; + $open = 0; + } + } //At this point the open should be zero if (0 != $open) { $valid = false; http://cvs.php.net/viewvc.cgi/pear/Structures_BibTex/BibTexTest.php?r1=1.5&r2=1.6&diff_format=u Index: pear/Structures_BibTex/BibTexTest.php diff -u pear/Structures_BibTex/BibTexTest.php:1.5 pear/Structures_BibTex/BibTexTest.php:1.6 --- pear/Structures_BibTex/BibTexTest.php:1.5 Thu Nov 2 20:25:01 2006 +++ pear/Structures_BibTex/BibTexTest.php Tue Nov 14 20:03:14 2006 @@ -335,7 +335,7 @@ function testWrongBraces3() { $teststring = "@Article { art1, title = {Titel1}, -author = {John Doe and {Jane Doe} +author = {John {Doe and {Jane Doe} }"; $this->obj->content = $teststring; $this->assertTrue(PEAR::isError($this->obj->parse())); @@ -734,6 +734,21 @@ $this->assertEquals($this->obj->amount(), 4); } + public function testMissingLastBraceParsing2() { + $this->obj->clearWarnings(); + $test = ' +@phdthesis{foo1, +school = {school1}, +title = {title1}, +author = {author1}, +year = {year1} + '; + $this->obj->content = $test; + $this->obj->setOption('validate', true); + $this->obj->parse(); + $this->assertEquals($this->obj->amount(), 1); + } + public function testMissingLastBraceWarning() { $this->obj->clearWarnings(); $test = '

« previous php.pear.cvs (#43080) next »