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

Bug #16642 Warnings when processing a marcxml record
Submitted: 2009-09-24 23:42 UTC
From: timothyprettyman Assigned: dbs
Status: Closed Package: File_MARC (version 0.4.1)
PHP Version: 5.2.5 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 : 21 + 20 = ?

 
 [2009-09-24 23:42 UTC] timothyprettyman (Timothy Prettyman)
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)

Comments

 [2009-09-27 10:25 UTC] doconnor (Daniel O'Connor)
Can you attach the patch / mangled marc record?
 [2009-09-28 06:26 UTC] dbs (Dan Scott)
-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!