]> granicus.if.org Git - php/commitdiff
This commit was manufactured by cvs2svn to create branch 'PHP_5_0'.
authorSVN Migration <svn@php.net>
Mon, 4 Oct 2004 08:58:48 +0000 (08:58 +0000)
committerSVN Migration <svn@php.net>
Mon, 4 Oct 2004 08:58:48 +0000 (08:58 +0000)
Zend/tests/bug27798.phpt [new file with mode: 0755]

diff --git a/Zend/tests/bug27798.phpt b/Zend/tests/bug27798.phpt
new file mode 100755 (executable)
index 0000000..f0d1cd5
--- /dev/null
@@ -0,0 +1,72 @@
+--TEST--
+Bug #27798 (private / protected variables not exposed by get_object_vars() inside class)
+--FILE--
+<?php
+
+class Base
+{
+       public    $Foo = 1;
+       protected $Bar = 2;
+       private   $Baz = 3;
+       
+       function __construct()
+       {
+               echo __METHOD__ . "\n";
+               var_dump(get_object_vars($this));
+       }
+}
+
+class Child extends Base
+{
+       private   $Baz = 4;
+
+       function __construct()
+       {
+               parent::__construct();
+               echo __METHOD__ . "\n";
+               var_dump(get_object_vars($this));
+       }
+}
+
+var_dump(get_object_vars(new Base));
+var_dump(get_object_vars(new Child));
+
+?>
+===DONE===
+--EXPECT--
+Base::__construct
+array(3) {
+  ["Foo"]=>
+  int(1)
+  ["Bar"]=>
+  int(2)
+  ["Baz"]=>
+  int(3)
+}
+array(1) {
+  ["Foo"]=>
+  int(1)
+}
+Base::__construct
+array(3) {
+  ["Baz"]=>
+  int(4)
+  ["Foo"]=>
+  int(1)
+  ["Bar"]=>
+  int(2)
+}
+Child::__construct
+array(3) {
+  ["Baz"]=>
+  int(4)
+  ["Foo"]=>
+  int(1)
+  ["Bar"]=>
+  int(2)
+}
+array(1) {
+  ["Foo"]=>
+  int(1)
+}
+===DONE===