File_MARC: 1.0.1 release fixes data corruption bug
Posted on Thu 31 October 2013 in Libraries
I released File_MARC 1.0.1 yesterday after receiving a bug report from the most excellent Mark Jordan about a basic (but data corrupting) problem that had existed since the very early days (almost seven years ago). If you generate MARC binary output from File_MARC, you should upgrade immediately.
In the MARC binary output code, I was testing a string for the presence of a value--roughly, "if ($value)"--and returning false if no value was present. Which is fine, except when said value was '0', in which case that test returns FALSE. Whoops.
It's one of the oldest gotchas in PHP, and it lived for a very long time in this library. Probably because very few people want to generate MARC binary output. But now, that bug is squashed, and a unit test will ensure that it does not come back.