Closed k33nice closed 7 years ago
You can just make simple update to your test_suite files. I guess, replacing empty {} with empty [] is enough.
@koorchik Not exactly, for example for rule anyObject we have positive test with {}, and negative with [], so needs to remove one of (https://github.com/k33nice/php-validator-livr/commit/f93a1b76b1df77141cf9e223c3e17b9d01bc2fe2). Its's posible to pass by modifying test_suites, but that's broke cross-language test_suites compability, and complicate updating.
@koorchik After updating test suites from V2.0, and implementing new features some problems have emerged. PHP language implements Array as decorated HashMap, and
json_decode
function, with passed 'true' as second argument, parse JSON string into PHP Array. Thus it's impossible to figure out javascript empty object or empty array in JSON string by decoding into PHP Array. Anyway it's posible, if parse JSON string with passing 'false' as second argument (in that casejson_decode
convert javascript objects into PHP stdClasses), but it would be weird cos native PHP url parser produce associative Array instead of stdClass. So PHP programmers are used to parse JSON in PHP Array.