When passing objects from JS to PHP with mixed keys, some of the keys
might get lost or "re-indexed". This fixes it and adds two tests.