Edit report at https://bugs.php.net/bug.php?id=72170&edit=1
ID: 72170
Updated by: davey@php.net
Reported by: laruence@php.net
Summary: JsonSerializable may inc apply count without dec it
-Status: Re-Opened
+Status: Closed
Type: Bug
Package: JSON related
PHP Version: 7.0.6
Assigned To: bukka
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=197470b62f8256898adfe758302cb0241195c480
Log: Revert "Fixed bug #72170 (JsonSerializable may inc apply count without dec
it)"
Previous Comments:
------------------------------------------------------------------------
[2016-05-06 12:25:50] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=197470b62f8256898adfe758302cb0241195c480
Log: Revert "Fixed bug #72170 (JsonSerializable may inc apply count without dec
it)"
------------------------------------------------------------------------
[2016-05-06 10:48:44] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=459a7cc209da130256d66c1f896199540f4dadbc
Log: Fixed bug #72170 (JsonSerializable may inc apply count without dec it)
------------------------------------------------------------------------
[2016-05-06 10:46:46] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=459a7cc209da130256d66c1f896199540f4dadbc
Log: Fixed bug #72170 (JsonSerializable may inc apply count without dec it)
------------------------------------------------------------------------
[2016-05-06 10:30:27] laruence@php.net
Description:
------------
see test script
Test script:
---------------
<?php
class Dummy implements JsonSerializable{
public function jsonSerialize() {
global $flag;
if ($flag) {
exit;
} else {
return "xxxx";
}
}
}
$array = array(new Dummy());
$array[] = "xxx";
register_shutdown_function(function() use($array) {
global $flag;
$flag = 0;
var_dump(json_encode(array($array)));
});
$flag = 1;
var_dump(json_encode(array($array)));
Expected result:
----------------
string(16) "[["xxxx","xxx"]]"
Actual result:
--------------
false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72170&edit=1