mirror of
https://github.com/php/php-src.git
synced 2026-04-25 08:58:28 +02:00
90fea67546
Instead of populating a hashtable of property names and then directly serializing. This has the advantage of a) detecting duplicate properties more precisely and b) gives us the ability to discard values without rewriting the serialization string after the fact for GH-5027.
17 lines
411 B
PHP
17 lines
411 B
PHP
--TEST--
|
|
__sleep() returns properties clashing only after mangling
|
|
--FILE--
|
|
<?php
|
|
class Test {
|
|
private $priv;
|
|
public function __sleep() {
|
|
return ["\0Test\0priv", "priv"];
|
|
}
|
|
}
|
|
$s = serialize(new Test);
|
|
var_dump(str_replace("\0", '\0', $s));
|
|
?>
|
|
--EXPECTF--
|
|
Notice: serialize(): "priv" is returned from __sleep multiple times in %s on line %d
|
|
string(37) "O:4:"Test":1:{s:10:"\0Test\0priv";N;}"
|