MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 11 forks source link

Issue 325: SplitRepeatedValues metadata manipulator incorrectly reports failed regex #328

Closed mjordan closed 7 years ago

mjordan commented 7 years ago

Github issue: (#325)

What does this Pull Request do?

The problem was unnecessary checking of a preg_match()'s $matches within a loop.

In the process of debugging this, I discovered another, unrelated problem: some metadata manipulators throw an exception when the XML snippet they are processing has no length, writing the exception message "DOMDocument::loadXML(): Empty string supplied as input" to the mik.log. By checking for a length on their input and returning the input if the length is 0 we avoid those mik.log entries. With this check in place, the output MODS XML is complete and validates.

What's new?

Unnecessary check on $matches fixed; added check on $input to two other manipulators.

How should this be tested?

  1. modify the .ini file in the attached .zip to use file paths appropriate to your environment.
  2. in the master branch, run mik using the .ini file. You will see a manipulator.log file that contains WARNINGs about a failed regex.
  3. rename your output folder so it is not overwritten in the next step.
  4. check out the issue-325 branch and rerun mik. This time the manipulator.log contains no WARNINGs, but diffing some corresponding .xml output files will show that they are identical except for a timestamp in the CSV data element, which is to be expected.

Interested parties

@MarcusBarnes

issue-325.zip

mjordan commented 7 years ago

@MarcusBarnes I've resolved the conflicts using the nice Github GUI, which is so simple to use that I couldn't figure it out without consulting the documentation.

MarcusBarnes commented 7 years ago

@mjordan Thank you. I've tested and it appears to work as expected.

mjordan commented 7 years ago

Thanks! Branch deleted.