mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Merge branch 'PHP-5.5' into PHP-5.6
This commit is contained in:
commit
db375cfd4d
4
NEWS
4
NEWS
@ -27,6 +27,10 @@
|
||||
. Fixed bug #68571 (core dump when webserver close the socket).
|
||||
(redfoxli069 at gmail dot com, Laruence)
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #68938 (json_decode() decodes empty string without error).
|
||||
(jeremy at bat-country dot us)
|
||||
|
||||
- LIBXML:
|
||||
. Fixed bug #64938 (libxml_disable_entity_loader setting is shared
|
||||
between threads). (Martin Jansen)
|
||||
|
@ -839,6 +839,7 @@ static PHP_FUNCTION(json_decode)
|
||||
JSON_G(error_code) = 0;
|
||||
|
||||
if (!str_len) {
|
||||
JSON_G(error_code) = PHP_JSON_ERROR_SYNTAX;
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,16 @@ json_decode("invalid json");
|
||||
var_dump(json_last_error());
|
||||
|
||||
|
||||
json_decode("\001 invalid json");
|
||||
var_dump(json_last_error());
|
||||
|
||||
|
||||
json_decode("");
|
||||
var_dump(json_last_error());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(0)
|
||||
int(4)
|
||||
int(0)
|
||||
int(4)
|
||||
int(3)
|
||||
int(4)
|
||||
|
11
ext/json/tests/bug68938.phpt
Normal file
11
ext/json/tests/bug68938.phpt
Normal file
@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #68938 (json_decode() decodes empty string without indicating error)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("json")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
json_decode("");
|
||||
var_dump(json_last_error());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4)
|
Loading…
Reference in New Issue
Block a user