Description
This is probably unfixable because of PHP, but I wanted to file it so it is on record.
If you parse a document that has no rels, you get back an empty JSON array in the json_encode
d output. If you parse a document that has rels, you get back a JSON object. The specification says you should get back an empty object.
Obviously, in PHP lists and dictionaries (in Python terminology) are unified into array which can represent both list-style arrays (numerically-keyed arrays in PHP), dictionary-style arrays (associative arrays) and mixed list and dictionary style. json_encode
lets you specify a flag for how you encode empty arrays.
One possible solution to this is to json_encode
each piece separately and then stitch them together. Or just ignore the problem and operate on the basis that PHP will never quite be spec-compliant.