1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 00:48:25 +02:00

Fixed bug #55543 (json_encode() with JSON_NUMERIC_CHECK fails on objects with numeric string properties)

This commit is contained in:
Ilia Alshanetsky
2011-10-17 23:51:25 +00:00
parent 077519d3fb
commit 65732af7da
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -297,7 +297,7 @@ static void json_encode_array(smart_str *buf, zval **val, int options TSRMLS_DC)
json_pretty_print_indent(buf, options TSRMLS_CC);
json_escape_string(buf, key, key_len - 1, options TSRMLS_CC);
json_escape_string(buf, key, key_len - 1, options & ~PHP_JSON_NUMERIC_CHECK TSRMLS_CC);
smart_str_appendc(buf, ':');
json_pretty_print_char(buf, options, ' ' TSRMLS_CC);
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #55543 (json_encode() with JSON_NUMERIC_CHECK & numeric string properties)
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
$a = new stdClass;
$a->{"1"} = "5";
var_dump(json_encode($a, JSON_NUMERIC_CHECK));
?>
--EXPECT--
string(7) "{"1":5}"