Bug #16642 [Opn->Csd]: Warnings when processing a marcxml record

From: Date: Mon, 28 Sep 2009 01:26:56 +0000
Subject: Bug #16642 [Opn->Csd]: Warnings when processing a marcxml record
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-1749@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=16642&edit=1 ID: 16642 Updated by: denials@gmail.com Reported By: timothy at umich dot edu Summary: Warnings when processing a marcxml record -Status: Open +Status: Closed Type: Bug Package: File_MARC Operating System: Linux Package Version: 0.4.1 PHP Version: 5.2.5 -Assigned To: +Assigned To: dbs Roadmap Versions: New Comment: -Status: Open +Status: Closed -Assigned To: +Assigned To: dbs Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/ I have added a new test, marc_xml_16642.phpt, reproduced the warnings, and committed a fix as part of File_MARC 0.4.2. Thanks for the bug report and the suggested fix! Previous Comments: ------------------------------------------------------------------------ [2009-09-27 06:25:35] doconnor Can you attach the patch / mangled marc record? ------------------------------------------------------------------------ [2009-09-24 19:42:32] timothyprettyman Description: ------------ I get the following warning: Warning: Illegal type returned from File_MARC_List::key() when processing a marcxml record with File_marcxml. The attached patch to MARCXML.php gets rid of the warnings. It casts the arguments to File_MARC_Control_Field and Flle_MARC_subfield to strings. Test script: --------------- <?php require 'File/MARCXML.php'; // Retrieve a set of MARC records from a file $records = new File_MARCXML('test.xml'); // Iterate through the retrieved records while ($record = $records->next()) { foreach ($record->getFields() as $tag => $subfields) { // Skip everything except for 650 fields if ($tag == '650') { print "Subject:"; foreach ($subfields->getSubfields() as $code => $value) { print " $value"; } print "\n"; } } } ?> Expected result: ---------------- Output should be (what I get from the patched version): Subject: [a]: Education [z]: Michigan [x]: Aims and objectives. Subject: [a]: Instructional systems [z]: Michigan. Subject: [a]: Educational evaluation [z]: Michigan. Subject: [a]: Educational planning [z]: Michigan. Actual result: -------------- Warning: Illegal type returned from File_MARC_List::key() in /n1/vufind/web/timothy/web/test.php on line 9 PHP Warning: Illegal type returned from File_MARC_List::key() in /n1/vufind/web/timothy/web/test.php on line 9 Warning: Illegal type returned from File_MARC_List::key() in /n1/vufind/web/timothy/web/test.php on line 9 PHP Warning: Illegal type returned from File_MARC_List::key() in /n1/vufind/web/timothy/web/test.php on line 9 Warning: Illegal type returned from File_MARC_List::key() in /n1/vufind/web/timothy/web/test.php on line 9 PHP Warning: Illegal type returned from File_MARC_List::key() in /n1/vufind/web/timothy/web/test.php on line 9 (repeated many times) ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=16642&edit=1

« previous php.pear.bugs (#1749) next »