diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-05-14 14:27:10 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-11 10:28:29 +0200 |
commit | eecd8961d94c50cc6cdc94ec80df8c1ce4881a76 (patch) | |
tree | a88fa55b88f402be6883d3349785d55b64f24aca /Zend/tests | |
parent | 3ff489d8e8672ca5cd23f4836ce86fbbd46b2ec4 (diff) | |
download | php-git-eecd8961d94c50cc6cdc94ec80df8c1ce4881a76.tar.gz |
Add get_mangled_object_vars() function
Diffstat (limited to 'Zend/tests')
-rw-r--r-- | Zend/tests/get_mangled_object_vars.phpt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Zend/tests/get_mangled_object_vars.phpt b/Zend/tests/get_mangled_object_vars.phpt new file mode 100644 index 0000000000..735548579e --- /dev/null +++ b/Zend/tests/get_mangled_object_vars.phpt @@ -0,0 +1,49 @@ +--TEST-- +get_mangled_object_vars() function +--FILE-- +<?php + +class A { + public $pub = 1; + protected $prot = 2; + private $priv = 3; +} +class B extends A { + private $priv = 4; +} + +$obj = new B; +$obj->dyn = 5; +$obj->{"6"} = 6; + +var_export(get_mangled_object_vars($obj)); +echo "\n"; + +class AO extends ArrayObject { + private $priv = 1; +} + +$ao = new AO(['x' => 'y']); +$ao->dyn = 2; +var_export(get_mangled_object_vars($ao)); +echo "\n"; +var_export((array) $ao); +echo "\n"; + +?> +--EXPECT-- +array ( + '' . "\0" . 'B' . "\0" . 'priv' => 4, + 'pub' => 1, + '' . "\0" . '*' . "\0" . 'prot' => 2, + '' . "\0" . 'A' . "\0" . 'priv' => 3, + 'dyn' => 5, + 6 => 6, +) +array ( + '' . "\0" . 'AO' . "\0" . 'priv' => 1, + 'dyn' => 2, +) +array ( + 'x' => 'y', +) |