-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #190 from TysonAndre/fix-custom-serializer
Fix memory leak/failed check for duplicates when serializing arrays and object
- Loading branch information
Showing
3 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--TEST-- | ||
APC: apcu_store/fetch with arrays with duplicate object | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> | ||
--INI-- | ||
apc.enabled=1 | ||
apc.enable_cli=1 | ||
apc.file_update_protection=0 | ||
--FILE-- | ||
<?php | ||
|
||
$o = new stdClass(); | ||
$foo = array($o, $o); | ||
|
||
var_dump($foo); | ||
|
||
apcu_store('foo',$foo); | ||
|
||
$bar = apcu_fetch('foo'); | ||
var_dump($foo); | ||
// $bar[0] should be identical to $bar[1], and not a reference | ||
var_dump($bar); | ||
?> | ||
===DONE=== | ||
<?php exit(0); ?> | ||
--EXPECTF-- | ||
array(2) { | ||
[0]=> | ||
object(stdClass)#1 (0) { | ||
} | ||
[1]=> | ||
object(stdClass)#1 (0) { | ||
} | ||
} | ||
array(2) { | ||
[0]=> | ||
object(stdClass)#1 (0) { | ||
} | ||
[1]=> | ||
object(stdClass)#1 (0) { | ||
} | ||
} | ||
array(2) { | ||
[0]=> | ||
object(stdClass)#2 (0) { | ||
} | ||
[1]=> | ||
object(stdClass)#2 (0) { | ||
} | ||
} | ||
===DONE=== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--TEST-- | ||
APC: apcu_store/fetch with arrays with two object references | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> | ||
--INI-- | ||
apc.enabled=1 | ||
apc.enable_cli=1 | ||
apc.file_update_protection=0 | ||
--FILE-- | ||
<?php | ||
|
||
$o = new stdClass(); | ||
$foo = array(&$o, &$o); | ||
|
||
var_dump($foo); | ||
|
||
apcu_store('foo',$foo); | ||
|
||
$bar = apcu_fetch('foo'); | ||
var_dump($foo); | ||
// $bar[0] should be a reference to $bar[1]. | ||
var_dump($bar); | ||
$bar[0] = 'roh'; | ||
var_dump($bar); | ||
?> | ||
===DONE=== | ||
<?php exit(0); ?> | ||
--EXPECTF-- | ||
array(2) { | ||
[0]=> | ||
&object(stdClass)#1 (0) { | ||
} | ||
[1]=> | ||
&object(stdClass)#1 (0) { | ||
} | ||
} | ||
array(2) { | ||
[0]=> | ||
&object(stdClass)#1 (0) { | ||
} | ||
[1]=> | ||
&object(stdClass)#1 (0) { | ||
} | ||
} | ||
array(2) { | ||
[0]=> | ||
&object(stdClass)#2 (0) { | ||
} | ||
[1]=> | ||
&object(stdClass)#2 (0) { | ||
} | ||
} | ||
array(2) { | ||
[0]=> | ||
&string(3) "roh" | ||
[1]=> | ||
&string(3) "roh" | ||
} | ||
===DONE=== |