diff options
author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 19:39:21 -0400 |
---|---|---|
committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 19:39:21 -0400 |
commit | 6821b67124604da690c5e9276d5370d679c63ac8 (patch) | |
tree | befb4ca2520eb577950cef6cb76d10b914cbf67a /tests/classes | |
parent | cd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (diff) | |
download | php-6821b67124604da690c5e9276d5370d679c63ac8.tar.gz |
Imported Upstream version 5.3.0RC1upstream/5.3.0_RC1upstream/5.3.0RC1
Diffstat (limited to 'tests/classes')
26 files changed, 333 insertions, 302 deletions
diff --git a/tests/classes/__call_005.phpt b/tests/classes/__call_005.phpt index c82a853f7..53c063aaf 100644 --- a/tests/classes/__call_005.phpt +++ b/tests/classes/__call_005.phpt @@ -22,6 +22,7 @@ $b = new B(); $b->test(); ?> --EXPECTF-- +Warning: The magic method __call() must have public visibility and can not be static in %s__call_005.php on line 3 In A::__call(test1, array(1,a)) object(B)#1 (0) { } @@ -33,4 +34,4 @@ object(B)#1 (0) { } In A::__call(test4, array(1,a)) object(B)#1 (0) { -}
\ No newline at end of file +} diff --git a/tests/classes/__call_007.phpt b/tests/classes/__call_007.phpt index 12e4df1c0..de225547d 100644 --- a/tests/classes/__call_007.phpt +++ b/tests/classes/__call_007.phpt @@ -52,6 +52,7 @@ try { ?> ==DONE== --EXPECTF-- +Warning: The magic method __call() must have public visibility and can not be static in %s on line 3 ---> Invoke __call via simple method call. NULL Exception caught OK; continuing. diff --git a/tests/classes/__set__get_005.phpt b/tests/classes/__set__get_005.phpt index 1a5533406..d8bbad3d4 100755 --- a/tests/classes/__set__get_005.phpt +++ b/tests/classes/__set__get_005.phpt @@ -56,7 +56,7 @@ AutoGen::__get Test::__set AutoGen::__get object(Test)#%d (1) { - ["x:protected"]=> + ["x":protected]=> array(1) { ["baz"]=> string(5) "Check" diff --git a/tests/classes/array_access_001.phpt b/tests/classes/array_access_001.phpt index 82f96d523..feed3fb8d 100644 --- a/tests/classes/array_access_001.phpt +++ b/tests/classes/array_access_001.phpt @@ -135,11 +135,11 @@ object::offsetGet(4th) int(4) object::offsetGet(5th) -Notice: Undefined index: 5th in %sarray_access_001.php on line %d +Notice: Undefined index: 5th in %sarray_access_001.php on line %d NULL object::offsetGet(6) -Notice: Undefined offset: 6 in %sarray_access_001.php on line %d +Notice: Undefined offset: 6 in %sarray_access_001.php on line %d NULL ===offsetSet=== WRITE 1 diff --git a/tests/classes/array_access_002.phpt b/tests/classes/array_access_002.phpt index fd08eb394..68640c83f 100644 --- a/tests/classes/array_access_002.phpt +++ b/tests/classes/array_access_002.phpt @@ -135,11 +135,11 @@ object::offsetGet(4th) int(4) object::offsetGet(5th) -Notice: Undefined index: 5th in %sarray_access_002.php on line %d +Notice: Undefined index: 5th in %sarray_access_002.php on line %d NULL object::offsetGet(6) -Notice: Undefined offset: 6 in %sarray_access_002.php on line %d +Notice: Undefined offset: 6 in %sarray_access_002.php on line %d NULL ===offsetSet=== WRITE 1 diff --git a/tests/classes/array_access_009.phpt b/tests/classes/array_access_009.phpt index b1382a639..386224026 100755 --- a/tests/classes/array_access_009.phpt +++ b/tests/classes/array_access_009.phpt @@ -130,7 +130,7 @@ string(9) "FooBarBaz" ===ArrayOverloading=== ArrayProxy::__construct(0) object(ArrayProxy)#%d (2) { - ["object:private"]=> + ["object":"ArrayProxy":private]=> object(Peoples)#%d (1) { ["person"]=> array(1) { @@ -141,7 +141,7 @@ object(ArrayProxy)#%d (2) { } } } - ["element:private"]=> + ["element":"ArrayProxy":private]=> int(0) } ArrayProxy::__construct(0) @@ -167,7 +167,7 @@ ArrayProxy::__construct(0) ArrayProxy::offsetUnset(0, name) ArrayProxy::__construct(0) object(ArrayProxy)#%d (2) { - ["object:private"]=> + ["object":"ArrayProxy":private]=> object(Peoples)#%d (1) { ["person"]=> array(1) { @@ -176,7 +176,7 @@ object(ArrayProxy)#%d (2) { } } } - ["element:private"]=> + ["element":"ArrayProxy":private]=> int(0) } ArrayProxy::__construct(0) diff --git a/tests/classes/array_access_010.phpt b/tests/classes/array_access_010.phpt index 9cb883d98..e60716dc1 100755 --- a/tests/classes/array_access_010.phpt +++ b/tests/classes/array_access_010.phpt @@ -104,7 +104,7 @@ string(9) "FooBarBaz" ===ArrayOverloading=== ArrayReferenceProxy::__construct(Array) object(ArrayReferenceProxy)#%d (2) { - ["object:private"]=> + ["object":"ArrayReferenceProxy":private]=> object(Peoples)#%d (1) { ["person"]=> array(1) { @@ -115,7 +115,7 @@ object(ArrayReferenceProxy)#%d (2) { } } } - ["element:private"]=> + ["element":"ArrayReferenceProxy":private]=> &array(1) { ["name"]=> string(3) "Foo" @@ -144,7 +144,7 @@ ArrayReferenceProxy::__construct(Array) ArrayReferenceProxy::offsetUnset(Array, name) ArrayReferenceProxy::__construct(Array) object(ArrayReferenceProxy)#%d (2) { - ["object:private"]=> + ["object":"ArrayReferenceProxy":private]=> object(Peoples)#%d (1) { ["person"]=> array(1) { @@ -153,7 +153,7 @@ object(ArrayReferenceProxy)#%d (2) { } } } - ["element:private"]=> + ["element":"ArrayReferenceProxy":private]=> &array(0) { } } diff --git a/tests/classes/array_access_011.phpt b/tests/classes/array_access_011.phpt index a6bb3d1ca..aa20a56d3 100755 --- a/tests/classes/array_access_011.phpt +++ b/tests/classes/array_access_011.phpt @@ -113,7 +113,7 @@ string(9) "FooBarBaz" ===ArrayOverloading=== ArrayAccessReferenceProxy::__construct(0) object(ArrayAccessReferenceProxy)#%d (3) { - ["object:private"]=> + ["object":"ArrayAccessReferenceProxy":private]=> object(Peoples)#%d (1) { ["person"]=> &array(1) { @@ -124,7 +124,7 @@ object(ArrayAccessReferenceProxy)#%d (3) { } } } - ["oarray:private"]=> + ["oarray":"ArrayAccessReferenceProxy":private]=> &array(1) { [0]=> array(1) { @@ -132,7 +132,7 @@ object(ArrayAccessReferenceProxy)#%d (3) { string(3) "Foo" } } - ["element:private"]=> + ["element":"ArrayAccessReferenceProxy":private]=> int(0) } ArrayAccessReferenceProxy::__construct(0) @@ -158,7 +158,7 @@ ArrayAccessReferenceProxy::__construct(0) ArrayAccessReferenceProxy::offsetUnset(0, name) ArrayAccessReferenceProxy::__construct(0) object(ArrayAccessReferenceProxy)#%d (3) { - ["object:private"]=> + ["object":"ArrayAccessReferenceProxy":private]=> object(Peoples)#%d (1) { ["person"]=> &array(1) { @@ -167,13 +167,13 @@ object(ArrayAccessReferenceProxy)#%d (3) { } } } - ["oarray:private"]=> + ["oarray":"ArrayAccessReferenceProxy":private]=> &array(1) { [0]=> array(0) { } } - ["element:private"]=> + ["element":"ArrayAccessReferenceProxy":private]=> int(0) } ArrayAccessReferenceProxy::__construct(0) diff --git a/tests/classes/arrayobject_001.phpt b/tests/classes/arrayobject_001.phpt new file mode 100644 index 000000000..51208f8c6 --- /dev/null +++ b/tests/classes/arrayobject_001.phpt @@ -0,0 +1,14 @@ +--TEST-- +Ensure that ArrayObject acts like an array +--SKIPIF-- +--FILE-- +<?php + +$a = new ArrayObject; +$a['foo'] = 'bar'; +echo reset($a); +echo count($a); +echo current($a); +?> +--EXPECT-- +bar1bar diff --git a/tests/classes/autoload_012.phpt b/tests/classes/autoload_012.phpt index 1f516cb4b..d6750b760 100644 --- a/tests/classes/autoload_012.phpt +++ b/tests/classes/autoload_012.phpt @@ -12,5 +12,4 @@ Ensure callback methods in unknown classes trigger autoload. --EXPECTF-- In autoload: string(6) "UndefC" -Warning: call_user_func(UndefC::test): First argument is expected to be a valid callback in %s on line %d - +Warning: call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found in %s on line %d diff --git a/tests/classes/bug27504.phpt b/tests/classes/bug27504.phpt index ca13990c9..5f2c5a03c 100644 --- a/tests/classes/bug27504.phpt +++ b/tests/classes/bug27504.phpt @@ -18,8 +18,8 @@ Bug #27504 (call_user_func_array allows calling of private/protected methods) $foo->bar('3'); ?> --EXPECTF-- -Called function foo:bar(%d) +Called function foo:bar(1) -Warning: call_user_func_array(): First argument is expected to be a valid callback, 'foo::bar' was given in %sbug27504.php on line %d +Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar() in %s on line %d Fatal error: Call to private method foo::bar() from context '' in %s on line %d diff --git a/tests/classes/clone_003.phpt b/tests/classes/clone_003.phpt index 658810825..9a251c506 100755 --- a/tests/classes/clone_003.phpt +++ b/tests/classes/clone_003.phpt @@ -43,7 +43,7 @@ test Object [p4] => A [p5] => test:5 [p2] => base:2 - [p6:private] => base:6 + [p6:base:private] => base:6 ) Clown test Object @@ -53,6 +53,6 @@ test Object [p4] => A [p5] => clone:5 [p2] => base:2 - [p6:private] => base:6 + [p6:base:private] => base:6 ) Done diff --git a/tests/classes/destructor_and_exceptions.phpt b/tests/classes/destructor_and_exceptions.phpt index 947aa5bb9..8100c9246 100755 --- a/tests/classes/destructor_and_exceptions.phpt +++ b/tests/classes/destructor_and_exceptions.phpt @@ -1,60 +1,60 @@ ---TEST--
-ZE2 catch exception thrown in destructor
---FILE--
-<?php
-
-class FailClass
-{
- public $fatal;
-
- function __destruct()
- {
- echo __METHOD__ . "\n";
- throw new exception("FailClass");
- echo "Done: " . __METHOD__ . "\n";
- }
-}
-
-try
-{
- $a = new FailClass;
- unset($a);
-}
-catch(Exception $e)
-{
- echo "Caught: " . $e->getMessage() . "\n";
-}
-
-class FatalException extends Exception
-{
- function __construct($what)
- {
- echo __METHOD__ . "\n";
- $o = new FailClass;
- unset($o);
- echo "Done: " . __METHOD__ . "\n";
- }
-}
-
-try
-{
- throw new FatalException("Damn");
-}
-catch(Exception $e)
-{
- echo "Caught Exception: " . $e->getMessage() . "\n";
-}
-catch(FatalException $e)
-{
- echo "Caught FatalException: " . $e->getMessage() . "\n";
-}
-
-?>
-===DONE===
---EXPECTF--
-FailClass::__destruct
-Caught: FailClass
-FatalException::__construct
-FailClass::__destruct
-Caught Exception: FailClass
-===DONE===
+--TEST-- +ZE2 catch exception thrown in destructor +--FILE-- +<?php + +class FailClass +{ + public $fatal; + + function __destruct() + { + echo __METHOD__ . "\n"; + throw new exception("FailClass"); + echo "Done: " . __METHOD__ . "\n"; + } +} + +try +{ + $a = new FailClass; + unset($a); +} +catch(Exception $e) +{ + echo "Caught: " . $e->getMessage() . "\n"; +} + +class FatalException extends Exception +{ + function __construct($what) + { + echo __METHOD__ . "\n"; + $o = new FailClass; + unset($o); + echo "Done: " . __METHOD__ . "\n"; + } +} + +try +{ + throw new FatalException("Damn"); +} +catch(Exception $e) +{ + echo "Caught Exception: " . $e->getMessage() . "\n"; +} +catch(FatalException $e) +{ + echo "Caught FatalException: " . $e->getMessage() . "\n"; +} + +?> +===DONE=== +--EXPECTF-- +FailClass::__destruct +Caught: FailClass +FatalException::__construct +FailClass::__destruct +Caught Exception: FailClass +===DONE=== diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt index d37e864e2..3a61ecf90 100644 --- a/tests/classes/final_ctor3.phpt +++ b/tests/classes/final_ctor3.phpt @@ -6,10 +6,8 @@ Ensure implicit final inherited old-style constructor cannot be overridden. final function A() { } } class B extends A { - } - class C extends B { - function B() { } + function A() { } } ?> --EXPECTF-- -Fatal error: Cannot override final method A::B() in %s on line 9 +Fatal error: Cannot override final method A::A() in %s on line %d diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt index b6f47b2a6..8990264d9 100644 --- a/tests/classes/inheritance_005.phpt +++ b/tests/classes/inheritance_005.phpt @@ -19,24 +19,39 @@ Check for inherited old-style constructor. } - echo "About to construct new B: "; + echo "About to construct new B: \n"; $b = new B; - echo "About to invoke implicit B::B(): "; - $b->B(); - echo "\nAbout to construct new C: "; + echo "Is B::B() callable?\n"; + var_dump(is_callable(array($b, "B"))); + + echo "Is B::A() callable?\n"; + var_dump(is_callable(array($b, "A"))); + + echo "About to construct new C: \n"; $c = new C; - echo "About to invoke implicit C::B(): "; - $c->B(); - echo "About to invoke implicit C::C(): "; - $c->C(); -?> ---EXPECTF-- -About to construct new B: In A::A -About to invoke implicit B::B(): In A::A -About to construct new C: In A::A -About to invoke implicit C::B(): In A::A -About to invoke implicit C::C(): In A::A + echo "Is C::A() callable?\n"; + var_dump(is_callable(array($c, "A"))); + echo "Is C::B() callable?\n"; + var_dump(is_callable(array($c, "B"))); + echo "Is C::C() callable?\n"; + var_dump(is_callable(array($c, "C"))); +?> +--EXPECTF-- +About to construct new B: +In A::A +Is B::B() callable? +bool(false) +Is B::A() callable? +bool(true) +About to construct new C: +In A::A +Is C::A() callable? +bool(true) +Is C::B() callable? +bool(false) +Is C::C() callable? +bool(false) diff --git a/tests/classes/inheritance_006.phpt b/tests/classes/inheritance_006.phpt index 7376ce1a8..d51dafeed 100644 --- a/tests/classes/inheritance_006.phpt +++ b/tests/classes/inheritance_006.phpt @@ -17,8 +17,8 @@ var_dump(new C); ?> --EXPECTF-- object(C)#%d (2) { - ["c:private"]=> + [%u|b%"c":%u|b%"B":private]=> NULL - ["c:private"]=> + [%u|b%"c":%u|b%"A":private]=> NULL }
\ No newline at end of file diff --git a/tests/classes/interface_constant_inheritance_004.phpt b/tests/classes/interface_constant_inheritance_004.phpt index 05b897236..f05592957 100644 --- a/tests/classes/interface_constant_inheritance_004.phpt +++ b/tests/classes/interface_constant_inheritance_004.phpt @@ -1,5 +1,5 @@ --TEST-- -Ensure a class may implement two interfaces which include the same constant due to inheritance. +Ensure a class may implement two interfaces which include the same constant (due to inheritance). --FILE-- <?php interface IA { diff --git a/tests/classes/interface_optional_arg.phpt b/tests/classes/interface_optional_arg.phpt index 5efabd094..05f2fc41d 100755 --- a/tests/classes/interface_optional_arg.phpt +++ b/tests/classes/interface_optional_arg.phpt @@ -1,27 +1,27 @@ ---TEST--
-ZE2 An interface method allows additional default arguments
---SKIPIF--
-<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
---FILE--
-<?php
-
-error_reporting(4095);
-
-interface test {
- public function bar();
-}
-
-class foo implements test {
-
- public function bar($foo = NULL) {
- echo "foo\n";
- }
-}
-
-$foo = new foo;
-$foo->bar();
-
-?>
---EXPECT--
-foo
-
+--TEST-- +ZE2 An interface method allows additional default arguments +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +error_reporting(4095); + +interface test { + public function bar(); +} + +class foo implements test { + + public function bar($foo = NULL) { + echo "foo\n"; + } +} + +$foo = new foo; +$foo->bar(); + +?> +--EXPECT-- +foo + diff --git a/tests/classes/iterators_006.phpt b/tests/classes/iterators_006.phpt index b2ebfb3a7..47fa69087 100644 --- a/tests/classes/iterators_006.phpt +++ b/tests/classes/iterators_006.phpt @@ -1,87 +1,87 @@ ---TEST--
-ZE2 iterators and array wrapping
+--TEST-- +ZE2 iterators and array wrapping --SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
---FILE--
-<?php
-
-class ai implements Iterator {
-
- private $array;
-
- function __construct() {
- $this->array = array('foo', 'bar', 'baz');
- }
-
- function rewind() {
- reset($this->array);
- $this->next();
- }
-
- function valid() {
- return $this->key !== NULL;
- }
-
- function key() {
- return $this->key;
- }
-
- function current() {
- return $this->current;
- }
-
- function next() {
- list($this->key, $this->current) = each($this->array);
-// list($key, $current) = each($this->array);
-// $this->key = $key;
-// $this->current = $current;
- }
-}
-
-class a implements IteratorAggregate {
-
- public function getIterator() {
- return new ai();
- }
-}
-
-$array = new a();
-
-foreach ($array as $property => $value) {
- print "$property: $value\n";
-}
-
-#$array = $array->getIterator();
-#$array->rewind();
-#$array->valid();
-#var_dump($array->key());
-#var_dump($array->current());
-echo "===2nd===\n";
-
-$array = new ai();
-
-foreach ($array as $property => $value) {
- print "$property: $value\n";
-}
-
-echo "===3rd===\n";
-
-foreach ($array as $property => $value) {
- print "$property: $value\n";
-}
-
-?>
-===DONE===
---EXPECT--
-0: foo
-1: bar
-2: baz
-===2nd===
-0: foo
-1: bar
-2: baz
-===3rd===
-0: foo
-1: bar
-2: baz
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?> +--FILE-- +<?php + +class ai implements Iterator { + + private $array; + + function __construct() { + $this->array = array('foo', 'bar', 'baz'); + } + + function rewind() { + reset($this->array); + $this->next(); + } + + function valid() { + return $this->key !== NULL; + } + + function key() { + return $this->key; + } + + function current() { + return $this->current; + } + + function next() { + list($this->key, $this->current) = each($this->array); +// list($key, $current) = each($this->array); +// $this->key = $key; +// $this->current = $current; + } +} + +class a implements IteratorAggregate { + + public function getIterator() { + return new ai(); + } +} + +$array = new a(); + +foreach ($array as $property => $value) { + print "$property: $value\n"; +} + +#$array = $array->getIterator(); +#$array->rewind(); +#$array->valid(); +#var_dump($array->key()); +#var_dump($array->current()); +echo "===2nd===\n"; + +$array = new ai(); + +foreach ($array as $property => $value) { + print "$property: $value\n"; +} + +echo "===3rd===\n"; + +foreach ($array as $property => $value) { + print "$property: $value\n"; +} + +?> +===DONE=== +--EXPECT-- +0: foo +1: bar +2: baz +===2nd=== +0: foo +1: bar +2: baz +===3rd=== +0: foo +1: bar +2: baz ===DONE===
\ No newline at end of file diff --git a/tests/classes/new_001.phpt b/tests/classes/new_001.phpt index 8ef8a71e0..ee7d3529a 100644 --- a/tests/classes/new_001.phpt +++ b/tests/classes/new_001.phpt @@ -1,5 +1,7 @@ --TEST-- Confirm difference between assigning new directly and by reference. +--INI-- +error_reporting=E_ALL | E_DEPRECATED --FILE-- <?php echo "Compile-time strict error message should precede this.\n"; @@ -27,7 +29,7 @@ Confirm difference between assigning new directly and by reference. var_dump($f); ?> --EXPECTF-- -Strict Standards: Assigning the return value of new by reference is deprecated in %s on line 23 +Deprecated: Assigning the return value of new by reference is deprecated in %s on line 23 Compile-time strict error message should precede this. $f initially points to the first object: object(Inc)#%d (1) { diff --git a/tests/classes/private_members.phpt b/tests/classes/private_members.phpt index 1832ea0c4..a8ef9ab92 100755 --- a/tests/classes/private_members.phpt +++ b/tests/classes/private_members.phpt @@ -60,44 +60,44 @@ base::test derived Object ( [member] => derived::member (default) - [member:private] => base::member + [member:base:private] => base::member ) derived::test derived Object ( [member] => derived::member (default) - [member:private] => base::member + [member:base:private] => base::member ) base::__construct(end) base::test derived Object ( [member] => derived::member (default) - [member:private] => base::member + [member:base:private] => base::member ) base::test derived Object ( [member] => derived::member (default) - [member:private] => base::member + [member:base:private] => base::member ) derived::test derived Object ( [member] => derived::member (default) - [member:private] => base::member + [member:base:private] => base::member ) derived::__construct(end) base::test derived Object ( [member] => derived::member - [member:private] => base::member + [member:base:private] => base::member ) derived::test derived Object ( [member] => derived::member - [member:private] => base::member + [member:base:private] => base::member ) Done diff --git a/tests/classes/property_override_protectedStatic_publicStatic.phpt b/tests/classes/property_override_protectedStatic_publicStatic.phpt index 7e1955dd9..e437c5f30 100644 --- a/tests/classes/property_override_protectedStatic_publicStatic.phpt +++ b/tests/classes/property_override_protectedStatic_publicStatic.phpt @@ -27,5 +27,7 @@ Redeclare inherited protected static property as public static. B::showB(); ?> --EXPECTF-- +A::p (static) +A::p (static) +B::p (static) -Fatal error: Cannot change initial value of property static protected A::$p in class B in %s on line 18 diff --git a/tests/classes/property_override_protected_private.phpt b/tests/classes/property_override_protected_private.phpt index 93f0d23eb..22cceda17 100644 --- a/tests/classes/property_override_protected_private.phpt +++ b/tests/classes/property_override_protected_private.phpt @@ -1,6 +1,5 @@ --TEST-- -Redeclare inherited protected property as private. -Included for completeness (duplicates test Zend/tests/errmsg_023.phpt). +Redeclare inherited protected property as private (duplicates Zend/tests/errmsg_023.phpt). --FILE-- <?php class A diff --git a/tests/classes/property_recreate_private.phpt b/tests/classes/property_recreate_private.phpt index a43e78202..8bcf48535 100644 --- a/tests/classes/property_recreate_private.phpt +++ b/tests/classes/property_recreate_private.phpt @@ -53,27 +53,27 @@ var_dump($c); --EXPECTF-- Unset and recreate a superclass's private property: object(D)#%d (1) { - ["p:private"]=> - string(7) "changed" + [%u|b%"p":%u|b%"C":private]=> + %unicode|string%(7) "changed" } Unset superclass's private property, and recreate it as public in subclass: object(D)#%d (1) { - ["p"]=> - string(12) "changed in D" + [%u|b%"p"]=> + %unicode|string%(12) "changed in D" } Unset superclass's private property, and recreate it as public at global scope: object(D)#%d (1) { - ["p"]=> - string(34) "this will create a public property" + [%u|b%"p"]=> + %unicode|string%(34) "this will create a public property" } Unset and recreate a private property: object(C)#%d (1) { - ["p:private"]=> - string(7) "changed" + [%u|b%"p":%u|b%"C":private]=> + %unicode|string%(7) "changed" } Unset a private property, and attempt to recreate at global scope (expecting failure): diff --git a/tests/classes/property_recreate_protected.phpt b/tests/classes/property_recreate_protected.phpt index dbb24ecd0..4da4de87a 100644 --- a/tests/classes/property_recreate_protected.phpt +++ b/tests/classes/property_recreate_protected.phpt @@ -38,14 +38,14 @@ var_dump($d); --EXPECTF-- Unset and recreate a protected property from property's declaring class scope: object(D)#%d (1) { - ["p:protected"]=> - string(7) "changed" + [%u|b%"p":protected]=> + %unicode|string%(7) "changed" } Unset and recreate a protected property from subclass: object(D)#%d (1) { - ["p:protected"]=> - string(12) "changed in D" + [%u|b%"p":protected]=> + %unicode|string%(12) "changed in D" } Unset a protected property, and attempt to recreate it outside of scope (expected failure): diff --git a/tests/classes/visibility_005.phpt b/tests/classes/visibility_005.phpt index ef5daa11b..859a5f7b6 100755 --- a/tests/classes/visibility_005.phpt +++ b/tests/classes/visibility_005.phpt @@ -1,59 +1,59 @@ ---TEST--
-ZE2 foreach and property visibility
---FILE--
-<?php
-
-class base
-{
- public $a=1;
- protected $b=2;
- private $c=3;
-
- function f()
- {
- foreach($this as $k=>$v) {
- echo "$k=>$v\n";
- }
- }
-}
-
-class derived extends base
-{
-}
-
-$o = new base;
-$o->d = 4;
-echo "===base::function===\n";
-$o->f();
-echo "===base,foreach===\n";
-foreach($o as $k=>$v) {
- echo "$k=>$v\n";
-}
-
-$o = new derived;
-$o->d = 4;
-echo "===derived::function===\n";
-$o->f();
-echo "===derived,foreach===\n";
-foreach($o as $k=>$v) {
- echo "$k=>$v\n";
-}
-
-?>
---EXPECT--
-===base::function===
-a=>1
-b=>2
-c=>3
-d=>4
-===base,foreach===
-a=>1
-d=>4
-===derived::function===
-a=>1
-b=>2
-c=>3
-d=>4
-===derived,foreach===
-a=>1
-d=>4
+--TEST-- +ZE2 foreach and property visibility +--FILE-- +<?php + +class base +{ + public $a=1; + protected $b=2; + private $c=3; + + function f() + { + foreach($this as $k=>$v) { + echo "$k=>$v\n"; + } + } +} + +class derived extends base +{ +} + +$o = new base; +$o->d = 4; +echo "===base::function===\n"; +$o->f(); +echo "===base,foreach===\n"; +foreach($o as $k=>$v) { + echo "$k=>$v\n"; +} + +$o = new derived; +$o->d = 4; +echo "===derived::function===\n"; +$o->f(); +echo "===derived,foreach===\n"; +foreach($o as $k=>$v) { + echo "$k=>$v\n"; +} + +?> +--EXPECT-- +===base::function=== +a=>1 +b=>2 +c=>3 +d=>4 +===base,foreach=== +a=>1 +d=>4 +===derived::function=== +a=>1 +b=>2 +c=>3 +d=>4 +===derived,foreach=== +a=>1 +d=>4 |