You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array,
File_MARC_List given in /einwww/mycode/marc21import/vendor/scriptotek/marc/src/Record.php:115
Stack trace: #0 /einwww/mycode/marc21import/vendor/scriptotek/marc/src/Record.php(115):
array_map() #1 /einwww/mycode/marc21import/Marc21Import.php(125):
Scriptotek\Marc\Record->getFields() #2
There is a workaround if you force PCRE tag matching.
// fetch all fields works OK$foundFields = $record->getFields('.*', pcre: true);
// same fix MUST be used when fetching all subfields$fieldUsed->getSubfields('.*', pcre: true);
Scriptotek\Marc\Record::getFields() has a bug as it has in docs @return \Scriptotek\Marc\Fields\Field[] An array of wrapped fields. but that is not true and it throws fatal error.
This works because using PCRE it will return an array (it uses File_MARC_Record::getFields()) which Scriptotek\Marc\Record::getFields() expects
functiongetFields($spec = null, $pcre = null)
{
if (!$spec) {
return$this->fields; // <-------- THIS IS PROBLEMATIC as it returns \File_MARC_List
}
// Okay, we're actually looking for something specific$matches = array();
foreach ($this->fieldsas$field) {
if (($pcre && preg_match("/$spec/", $field->getTag()))
|| (!$pcre && $spec == $field->getTag())
) {
$matches[] = $field;
}
}
return$matches;
}
I tried manually using
"pear/file_marc": "master@dev"
but it has not helpedThe text was updated successfully, but these errors were encountered: