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

From: Date: Sun, 27 Sep 2009 05:25:35 +0000
Subject: Bug #16642 [Opn]: Warnings when processing a marcxml record
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-1738@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: daniel.oconnor@gmail.com Reported By: timothy at umich dot edu Summary: Warnings when processing a marcxml record Status: Open Type: Bug Package: File_MARC Operating System: Linux Package Version: 0.4.1 PHP Version: 5.2.5 Roadmap Versions: New Comment: Can you attach the patch / mangled marc record? Previous Comments: ------------------------------------------------------------------------ [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 (#1738) next »