json_decode() returns null issues

前端 未结 10 2151
误落风尘
误落风尘 2020-12-03 11:47

I\'ve an issue with my JSON. It works returns correctly in PHP 5.3 (so I can\'t use json_last_error()), and it returns successfully when I copy string explicitly into json_d

10条回答
  •  Happy的楠姐
    2020-12-03 12:24

    What a HORRENDOUS debug session.. well there's good news.. I figured it out..

    I started looking at it using AJAX and logging it with Firebug... and it turns out json_decode (or eval by the way) cannot handle ", which is what PHPUnit sends back (Come on Sebastian!), so to fix it:

    $json = str_replace('"', '"', $json);
    

    Now I thought they were the same.. maybe someone can enlighten me..

提交回复
热议问题