From a98368b6ac023ab1f1089b501d8212d49c3d9a2f Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Mon, 11 Oct 2010 12:41:05 +0200 Subject: [PATCH] bug in crossref for php4 due to PHP4 bad semantics --- bibtexbrowser.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 60a26a9..cc9590f 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -617,7 +617,7 @@ class BibDBBuilder { var $currentEntry; - function BibDBBuilder($filename, $builtdb = array(), $stringdb = array()) { + function BibDBBuilder($filename, &$builtdb, &$stringdb) { $this->builtdb = $builtdb; $this->stringdb = $stringdb; new StateBasedBibtexParser($filename, $this); @@ -629,7 +629,9 @@ class BibDBBuilder { function endFile() { // resolving crossrefs - foreach ($this->builtdb as $bib) { + // we are careful with PHP 4 semantics + foreach (array_keys($this->builtdb) as $key) { + $bib = &$this->builtdb[$key]; if ($bib->hasField('crossref')) { if (isset($this->builtdb[$bib->getField('crossref')])) { $crossrefEntry = $this->builtdb[$bib->getField('crossref')];