|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-08-22 08:00 UTC] m dot kurzyna at crystalpoint dot pl
Description:
------------
There is a regression in json_decode starting with PHP5.5 (5.4.x works as expected).
json_decode() now treats literals staring with an integer as valid JSON consisting only of the first character.
Test script:
---------------
<?php
var_dump(
json_decode("9af5"),
json_last_error()
);
Expected result:
----------------
NULL
int(4)
Actual result:
--------------
int(9)
int(0)
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 16:00:01 2025 UTC |
What is the return of php -r 'echo phpversion("json");'It seems my fedora 19 x86_64 does this, while my PHP-5.5 branch don't on the same machine. It seems packager's issue. $ php <?php var_dump( json_decode("9af5"), json_last_error() ); int(9) int(0) [yohgaki@dev PHP-5.5]$ ./php-bin <?php var_dump( json_decode("9af5"), json_last_error() ); NULL int(4)