Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/classes/array_conversion_keys.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Verifies the correct conversion of objects to arrays
--FILE--
<?php
class foo
{
private $private = 'private';
protected $protected = 'protected';
public $public = 'public';
}
var_export((array) new foo);
?>
--EXPECTF--
array (
'' . "\0" . 'foo' . "\0" . 'private' => 'private',
'' . "\0" . '*' . "\0" . 'protected' => 'protected',
'public' => 'public',
)
23 changes: 23 additions & 0 deletions tests/classes/private_members_serialization.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Verifies that it is possible to return private member names of parent classes in __sleep
--FILE--
<?php
class foo
{
private $private = 'private';
protected $protected = 'protected';
public $public = 'public';
}

class bar extends foo
{
public function __sleep()
{
return array("\0foo\0private", 'protected', 'public');
}
}

var_dump(str_replace("\0", '\0', serialize(new bar())));
?>
--EXPECTF--
string(114) "O:3:"bar":3:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";}"