diff options
Diffstat (limited to 'tests/classes')
206 files changed, 1904 insertions, 2378 deletions
diff --git a/tests/classes/__call_001.phpt b/tests/classes/__call_001.phpt index a70041ae16..654a020339 100644 --- a/tests/classes/__call_001.phpt +++ b/tests/classes/__call_001.phpt @@ -4,13 +4,13 @@ ZE2 __call() <?php class Caller { - public $x = array(1, 2, 3); + public $x = array(1, 2, 3); - function __call($m, $a) { - echo "Method $m called:\n"; - var_dump($a); - return $this->x; - } + function __call($m, $a) { + echo "Method $m called:\n"; + var_dump($a); + return $this->x; + } } $foo = new Caller(); diff --git a/tests/classes/__call_002.phpt b/tests/classes/__call_002.phpt index f58ec47dcb..a0df5a2390 100644 --- a/tests/classes/__call_002.phpt +++ b/tests/classes/__call_002.phpt @@ -4,8 +4,8 @@ ZE2 __call() signature check <?php class Test { - function __call() { - } + function __call() { + } } ?> diff --git a/tests/classes/__call_004.phpt b/tests/classes/__call_004.phpt index ca980c65f0..f8168cedab 100644 --- a/tests/classes/__call_004.phpt +++ b/tests/classes/__call_004.phpt @@ -3,24 +3,24 @@ When __call() is invoked via ::, ensure current scope's __call() is favoured ove --FILE-- <?php class A { - function __call($strMethod, $arrArgs) { - echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; - var_dump($this); - } + function __call($strMethod, $arrArgs) { + echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; + var_dump($this); + } } class B extends A { - function __call($strMethod, $arrArgs) { - echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; - var_dump($this); - } + function __call($strMethod, $arrArgs) { + echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; + var_dump($this); + } - function test() { - A::test1(1,'a'); - B::test2(1,'a'); - self::test3(1,'a'); - parent::test4(1,'a'); - } + function test() { + A::test1(1,'a'); + B::test2(1,'a'); + self::test3(1,'a'); + parent::test4(1,'a'); + } } $b = new B(); diff --git a/tests/classes/__call_005.phpt b/tests/classes/__call_005.phpt index 33c4df8e49..20416edb5d 100644 --- a/tests/classes/__call_005.phpt +++ b/tests/classes/__call_005.phpt @@ -3,26 +3,26 @@ When __call() is invoked via ::, ensure private implementation of __call() in su --FILE-- <?php class A { - private function __call($strMethod, $arrArgs) { - echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; - var_dump($this); - } + private function __call($strMethod, $arrArgs) { + echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n"; + var_dump($this); + } } class B extends A { - function test() { - A::test1(1,'a'); - B::test2(1,'a'); - self::test3(1,'a'); - parent::test4(1,'a'); - } + function test() { + A::test1(1,'a'); + B::test2(1,'a'); + self::test3(1,'a'); + parent::test4(1,'a'); + } } $b = new B(); $b->test(); ?> --EXPECTF-- -Warning: The magic method __call() must have public visibility and cannot be static in %s__call_005.php on line 3 +Warning: The magic method A::__call() must have public visibility in %s__call_005.php on line 3 In A::__call(test1, array(1,a)) object(B)#1 (0) { } diff --git a/tests/classes/__call_006.phpt b/tests/classes/__call_006.phpt index e6efdefe9e..6ffc75358f 100644 --- a/tests/classes/__call_006.phpt +++ b/tests/classes/__call_006.phpt @@ -3,54 +3,53 @@ Ensure exceptions are handled properly when thrown in __call. --FILE-- <?php class A { - function __call($strMethod, $arrArgs) { - var_dump($this); - throw new Exception; - echo "You should not see this"; - } - function test() { - A::unknownCalledWithSRO(1,2,3); - } + function __call($strMethod, $arrArgs) { + var_dump($this); + throw new Exception; + echo "You should not see this"; + } + function test() { + A::unknownCalledWithSRO(1,2,3); + } } class B extends A { - function test() { - B::unknownCalledWithSROFromChild(1,2,3); - } + function test() { + B::unknownCalledWithSROFromChild(1,2,3); + } } $a = new A(); echo "---> Invoke __call via simple method call.\n"; try { - $a->unknown(); + $a->unknown(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within instance.\n"; try { - $a->test(); + $a->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within child instance.\n"; $b = new B(); try { - $b->test(); + $b->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via callback.\n"; try { - call_user_func(array($b, 'unknownCallback'), 1,2,3); + call_user_func(array($b, 'unknownCallback'), 1,2,3); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } ?> -==DONE== --EXPECTF-- ---> Invoke __call via simple method call. object(A)#%d (0) { @@ -74,4 +73,3 @@ Exception caught OK; continuing. object(B)#%d (0) { } Exception caught OK; continuing. -==DONE== diff --git a/tests/classes/__call_007.phpt b/tests/classes/__call_007.phpt index a1dd4594e9..e2edb8a530 100644 --- a/tests/classes/__call_007.phpt +++ b/tests/classes/__call_007.phpt @@ -3,56 +3,55 @@ Ensure exceptions are handled properly when thrown in a statically declared __ca --FILE-- <?php class A { - static function __call($strMethod, $arrArgs) { - @var_dump($this); - throw new Exception; - echo "You should not see this"; - } - function test() { - A::unknownCalledWithSRO(1,2,3); - } + static function __call($strMethod, $arrArgs) { + @var_dump($this); + throw new Exception; + echo "You should not see this"; + } + function test() { + A::unknownCalledWithSRO(1,2,3); + } } class B extends A { - function test() { - B::unknownCalledWithSROFromChild(1,2,3); - } + function test() { + B::unknownCalledWithSROFromChild(1,2,3); + } } $a = new A(); echo "---> Invoke __call via simple method call.\n"; try { - $a->unknown(); + $a->unknown(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within instance.\n"; try { - $a->test(); + $a->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via scope resolution operator within child instance.\n"; $b = new B(); try { - $b->test(); + $b->test(); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } echo "\n\n---> Invoke __call via callback.\n"; try { - call_user_func(array($b, 'unknownCallback'), 1,2,3); + call_user_func(array($b, 'unknownCallback'), 1,2,3); } catch (Exception $e) { - echo "Exception caught OK; continuing.\n"; + echo "Exception caught OK; continuing.\n"; } ?> -==DONE== --EXPECTF-- -Warning: The magic method __call() must have public visibility and cannot be static in %s on line 3 +Warning: The magic method A::__call() cannot be static in %s on line 3 ---> Invoke __call via simple method call. object(A)#1 (0) { } @@ -75,4 +74,3 @@ Exception caught OK; continuing. object(B)#2 (0) { } Exception caught OK; continuing. -==DONE== diff --git a/tests/classes/__set__get_001.phpt b/tests/classes/__set__get_001.phpt index 244119a2d0..f240817f4a 100644 --- a/tests/classes/__set__get_001.phpt +++ b/tests/classes/__set__get_001.phpt @@ -3,33 +3,33 @@ ZE2 __set() and __get() --FILE-- <?php class setter { - public $n; - public $x = array('a' => 1, 'b' => 2, 'c' => 3); + public $n; + public $x = array('a' => 1, 'b' => 2, 'c' => 3); - function __get($nm) { - echo "Getting [$nm]\n"; + function __get($nm) { + echo "Getting [$nm]\n"; - if (isset($this->x[$nm])) { - $r = $this->x[$nm]; - echo "Returning: $r\n"; - return $r; - } - else { - echo "Nothing!\n"; - } - } + if (isset($this->x[$nm])) { + $r = $this->x[$nm]; + echo "Returning: $r\n"; + return $r; + } + else { + echo "Nothing!\n"; + } + } - function __set($nm, $val) { - echo "Setting [$nm] to $val\n"; + function __set($nm, $val) { + echo "Setting [$nm] to $val\n"; - if (isset($this->x[$nm])) { - $this->x[$nm] = $val; - echo "OK!\n"; - } - else { - echo "Not OK!\n"; - } - } + if (isset($this->x[$nm])) { + $this->x[$nm] = $val; + echo "OK!\n"; + } + else { + echo "Not OK!\n"; + } + } } $foo = new Setter(); diff --git a/tests/classes/__set__get_002.phpt b/tests/classes/__set__get_002.phpt index 5d3b5db543..5fb72e2106 100644 --- a/tests/classes/__set__get_002.phpt +++ b/tests/classes/__set__get_002.phpt @@ -3,8 +3,8 @@ ZE2 __get() signature check --FILE-- <?php class Test { - function __get($x,$y) { - } + function __get($x,$y) { + } } ?> diff --git a/tests/classes/__set__get_003.phpt b/tests/classes/__set__get_003.phpt index 16b09b76b1..0ebac3bccc 100644 --- a/tests/classes/__set__get_003.phpt +++ b/tests/classes/__set__get_003.phpt @@ -3,8 +3,8 @@ ZE2 __set() signature check --FILE-- <?php class Test { - function __set() { - } + function __set() { + } } ?> diff --git a/tests/classes/__set__get_004.phpt b/tests/classes/__set__get_004.phpt index 004edc973a..2818d9700f 100644 --- a/tests/classes/__set__get_004.phpt +++ b/tests/classes/__set__get_004.phpt @@ -3,21 +3,21 @@ ZE2 __set() and __get() --FILE-- <?php class Test { - protected $x; + protected $x; - function __get($name) { - if (isset($this->x[$name])) { - return $this->x[$name]; - } - else - { - return NULL; - } - } + function __get($name) { + if (isset($this->x[$name])) { + return $this->x[$name]; + } + else + { + return NULL; + } + } - function __set($name, $val) { - $this->x[$name] = $val; - } + function __set($name, $val) { + $this->x[$name] = $val; + } } $foo = new Test(); @@ -30,8 +30,6 @@ var_dump($bar->baz); var_dump($foo->bar->baz); ?> -===DONE=== --EXPECT-- string(5) "Check" string(5) "Check" -===DONE=== diff --git a/tests/classes/__set__get_005.phpt b/tests/classes/__set__get_005.phpt index 68cfb39df3..298c8b1e11 100644 --- a/tests/classes/__set__get_005.phpt +++ b/tests/classes/__set__get_005.phpt @@ -4,41 +4,41 @@ ZE2 __set() and __get() <?php class Test { - protected $x; + protected $x; - function __get($name) { - echo __METHOD__ . "\n"; - if (isset($this->x[$name])) { - return $this->x[$name]; - } - else - { - return NULL; - } - } + function __get($name) { + echo __METHOD__ . "\n"; + if (isset($this->x[$name])) { + return $this->x[$name]; + } + else + { + return NULL; + } + } - function __set($name, $val) { - echo __METHOD__ . "\n"; - $this->x[$name] = $val; - } + function __set($name, $val) { + echo __METHOD__ . "\n"; + $this->x[$name] = $val; + } } class AutoGen { - protected $x; + protected $x; - function __get($name) { - echo __METHOD__ . "\n"; - if (!isset($this->x[$name])) { - $this->x[$name] = new Test(); - } - return $this->x[$name]; - } + function __get($name) { + echo __METHOD__ . "\n"; + if (!isset($this->x[$name])) { + $this->x[$name] = new Test(); + } + return $this->x[$name]; + } - function __set($name, $val) { - echo __METHOD__ . "\n"; - $this->x[$name] = $val; - } + function __set($name, $val) { + echo __METHOD__ . "\n"; + $this->x[$name] = $val; + } } $foo = new AutoGen(); @@ -48,7 +48,6 @@ var_dump($foo->bar); var_dump($foo->bar->baz); ?> -===DONE=== --EXPECTF-- AutoGen::__get Test::__set @@ -63,4 +62,3 @@ object(Test)#%d (1) { AutoGen::__get Test::__get string(5) "Check" -===DONE=== diff --git a/tests/classes/abstract.phpt b/tests/classes/abstract.phpt index f46e5130a7..8286d6b6aa 100644 --- a/tests/classes/abstract.phpt +++ b/tests/classes/abstract.phpt @@ -4,16 +4,16 @@ ZE2 An abstract method may not be called <?php abstract class fail { - abstract function show(); + abstract function show(); } class pass extends fail { - function show() { - echo "Call to function show()\n"; - } - function error() { - parent::show(); - } + function show() { + echo "Call to function show()\n"; + } + function error() { + parent::show(); + } } $t = new pass(); diff --git a/tests/classes/abstract_by_interface_001.phpt b/tests/classes/abstract_by_interface_001.phpt index 4a746d0d22..a8a6ad31da 100644 --- a/tests/classes/abstract_by_interface_001.phpt +++ b/tests/classes/abstract_by_interface_001.phpt @@ -8,7 +8,7 @@ class Root { interface MyInterface { - function MyInterfaceFunc(); + function MyInterfaceFunc(); } abstract class Derived extends Root implements MyInterface { @@ -16,7 +16,7 @@ abstract class Derived extends Root implements MyInterface { class Leaf extends Derived { - function MyInterfaceFunc() {} + function MyInterfaceFunc() {} } var_dump(new Leaf); diff --git a/tests/classes/abstract_by_interface_002.phpt b/tests/classes/abstract_by_interface_002.phpt index a05660b5b9..83fc18ad95 100644 --- a/tests/classes/abstract_by_interface_002.phpt +++ b/tests/classes/abstract_by_interface_002.phpt @@ -8,7 +8,7 @@ class Root { interface MyInterface { - static function MyInterfaceFunc(); + static function MyInterfaceFunc(); } abstract class Derived extends Root implements MyInterface { @@ -16,7 +16,7 @@ abstract class Derived extends Root implements MyInterface { class Leaf extends Derived { - static function MyInterfaceFunc() {} + static function MyInterfaceFunc() {} } var_dump(new Leaf); diff --git a/tests/classes/abstract_class.phpt b/tests/classes/abstract_class.phpt index fabe890eae..2ede69805c 100644 --- a/tests/classes/abstract_class.phpt +++ b/tests/classes/abstract_class.phpt @@ -4,13 +4,13 @@ ZE2 An abstract class cannot be instantiated <?php abstract class fail { - abstract function show(); + abstract function show(); } class pass extends fail { - function show() { - echo "Call to function show()\n"; - } + function show() { + echo "Call to function show()\n"; + } } $t2 = new pass(); diff --git a/tests/classes/abstract_derived.phpt b/tests/classes/abstract_derived.phpt index a23205f9a5..db040e1342 100644 --- a/tests/classes/abstract_derived.phpt +++ b/tests/classes/abstract_derived.phpt @@ -7,11 +7,10 @@ class base { } class derived extends base { - abstract function show(); + abstract function show(); } ?> ===DONE=== -<?php exit(0); ?> --EXPECTF-- Fatal error: Class derived contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (derived::show) in %sabstract_derived.php on line %d diff --git a/tests/classes/abstract_final.phpt b/tests/classes/abstract_final.phpt index a82bfff227..70aece06fd 100644 --- a/tests/classes/abstract_final.phpt +++ b/tests/classes/abstract_final.phpt @@ -4,7 +4,7 @@ ZE2 A final method cannot be abstract <?php class fail { - abstract final function show(); + abstract final function show(); } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/abstract_inherit.phpt b/tests/classes/abstract_inherit.phpt index 8e9e118e08..6664fd3e90 100644 --- a/tests/classes/abstract_inherit.phpt +++ b/tests/classes/abstract_inherit.phpt @@ -4,7 +4,7 @@ ZE2 A class that inherits an abstract method is abstract <?php abstract class pass { - abstract function show(); + abstract function show(); } abstract class fail extends pass { diff --git a/tests/classes/abstract_not_declared.phpt b/tests/classes/abstract_not_declared.phpt index 8c2d880150..611cb3cc94 100644 --- a/tests/classes/abstract_not_declared.phpt +++ b/tests/classes/abstract_not_declared.phpt @@ -4,7 +4,7 @@ ZE2 An abstract class must be declared abstract <?php class fail { - abstract function show(); + abstract function show(); } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/abstract_redeclare.phpt b/tests/classes/abstract_redeclare.phpt index 5643cb7a61..843570ba2e 100644 --- a/tests/classes/abstract_redeclare.phpt +++ b/tests/classes/abstract_redeclare.phpt @@ -4,13 +4,13 @@ ZE2 A method cannot be redeclared abstract <?php class pass { - function show() { - echo "Call to function show()\n"; - } + function show() { + echo "Call to function show()\n"; + } } class fail extends pass { - abstract function show(); + abstract function show(); } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/abstract_static.phpt b/tests/classes/abstract_static.phpt index 9b9205af3e..60ff284784 100644 --- a/tests/classes/abstract_static.phpt +++ b/tests/classes/abstract_static.phpt @@ -5,14 +5,14 @@ ZE2 A static abstract methods interface showable { - static function show(); + static function show(); } class pass implements showable { - static function show() { - echo "Call to function show()\n"; - } + static function show() { + echo "Call to function show()\n"; + } } pass::show(); @@ -20,7 +20,7 @@ pass::show(); eval(' class fail { - abstract static function func(); + abstract static function func(); } '); diff --git a/tests/classes/abstract_user_call.phpt b/tests/classes/abstract_user_call.phpt index 6ce810c836..cd8c5c7e36 100644 --- a/tests/classes/abstract_user_call.phpt +++ b/tests/classes/abstract_user_call.phpt @@ -5,27 +5,28 @@ ZE2 An abstrcat method cannot be called indirectly abstract class test_base { - abstract function func(); + abstract function func(); } class test extends test_base { - function func() - { - echo __METHOD__ . "()\n"; - } + function func() + { + echo __METHOD__ . "()\n"; + } } $o = new test; $o->func(); -call_user_func(array($o, 'test_base::func')); +try { + call_user_func(array($o, 'test_base::func')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> -===DONE=== ---EXPECTF-- +--EXPECT-- test::func() - -Warning: call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method test_base::func() in %s on line %d -===DONE=== +call_user_func(): Argument #1 ($function) must be a valid callback, cannot call abstract method test_base::func() diff --git a/tests/classes/array_access_001.phpt b/tests/classes/array_access_001.phpt index 784a886126..ae2669b670 100644 --- a/tests/classes/array_access_001.phpt +++ b/tests/classes/array_access_001.phpt @@ -4,24 +4,24 @@ ZE2 ArrayAccess <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - return $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; @@ -82,7 +82,6 @@ unset($obj['8th']); var_dump($obj->a); ?> -===DONE=== --EXPECTF-- array(4) { [0]=> @@ -195,4 +194,3 @@ array(4) { [6]=> string(9) "changed 6" } -===DONE=== diff --git a/tests/classes/array_access_002.phpt b/tests/classes/array_access_002.phpt index 5e101914c0..79f4a52853 100644 --- a/tests/classes/array_access_002.phpt +++ b/tests/classes/array_access_002.phpt @@ -4,24 +4,24 @@ ZE2 ArrayAccess::offsetSet without return <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - /*return*/ $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + /*return*/ $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; @@ -82,7 +82,6 @@ unset($obj['8th']); var_dump($obj->a); ?> -===DONE=== --EXPECTF-- array(4) { [0]=> @@ -195,4 +194,3 @@ array(4) { [6]=> string(9) "changed 6" } -===DONE=== diff --git a/tests/classes/array_access_003.phpt b/tests/classes/array_access_003.phpt index 8924d1575f..dbaaa6b192 100644 --- a/tests/classes/array_access_003.phpt +++ b/tests/classes/array_access_003.phpt @@ -6,35 +6,35 @@ error_reporting=4095 <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - switch($index) { - case 1: - $a = 'foo'; - return $a . 'Bar'; - case 2: - static $a=1; - return $a; - } - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - if ($index==3) { - $this->cnt = $newval; - } - return $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + switch($index) { + case 1: + $a = 'foo'; + return $a . 'Bar'; + case 2: + static $a=1; + return $a; + } + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + if ($index==3) { + $this->cnt = $newval; + } + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; @@ -45,7 +45,6 @@ $obj[2]++; var_dump($obj[2]); ?> -===DONE=== --EXPECTF-- ObjectOne::offsetGet(1) string(6) "fooBar" @@ -56,4 +55,3 @@ ObjectOne::offsetGet(2) Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_003.php on line 39 ObjectOne::offsetGet(2) int(1) -===DONE=== diff --git a/tests/classes/array_access_004.phpt b/tests/classes/array_access_004.phpt index 22566937f2..882ca43762 100644 --- a/tests/classes/array_access_004.phpt +++ b/tests/classes/array_access_004.phpt @@ -4,35 +4,35 @@ ZE2 ArrayAccess::offsetGet ambiguties <?php class ObjectOne implements ArrayAccess { - public $a = array('1st', 1, 2=>'3rd', '4th'=>4); + public $a = array('1st', 1, 2=>'3rd', '4th'=>4); - function offsetExists($index) { - echo __METHOD__ . "($index)\n"; - return array_key_exists($index, $this->a); - } - function offsetGet($index) { - echo __METHOD__ . "($index)\n"; - switch($index) { - case 1: - $a = 'foo'; - return $a . 'Bar'; - case 2: - static $a=1; - return $a; - } - return $this->a[$index]; - } - function offsetSet($index, $newval) { - echo __METHOD__ . "($index,$newval)\n"; - if ($index==3) { - $this->cnt = $newval; - } - return $this->a[$index] = $newval; - } - function offsetUnset($index) { - echo __METHOD__ . "($index)\n"; - unset($this->a[$index]); - } + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + switch($index) { + case 1: + $a = 'foo'; + return $a . 'Bar'; + case 2: + static $a=1; + return $a; + } + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + if ($index==3) { + $this->cnt = $newval; + } + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } } $obj = new ObjectOne; @@ -43,7 +43,6 @@ $obj[2]++; var_dump($obj[2]); ?> -===DONE=== --EXPECTF-- ObjectOne::offsetGet(1) string(6) "fooBar" @@ -54,4 +53,3 @@ ObjectOne::offsetGet(2) Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_004.php on line 39 ObjectOne::offsetGet(2) int(1) -===DONE=== diff --git a/tests/classes/array_access_005.phpt b/tests/classes/array_access_005.phpt index 92ddeccaf2..7db50f2cb9 100644 --- a/tests/classes/array_access_005.phpt +++ b/tests/classes/array_access_005.phpt @@ -4,27 +4,27 @@ ZE2 ArrayAccess and sub Arrays <?php class Peoples implements ArrayAccess { - public $person; + public $person; - function __construct() { - $this->person = array(array('name'=>'Joe')); - } + function __construct() { + $this->person = array(array('name'=>'Joe')); + } - function offsetExists($index) { - return array_key_exists($this->person, $index); - } + function offsetExists($index) { + return array_key_exists($this->person, $index); + } - function offsetGet($index) { - return $this->person[$index]; - } + function offsetGet($index) { + return $this->person[$index]; + } - function offsetSet($index, $value) { - $this->person[$index] = $value; - } + function offsetSet($index, $value) { + $this->person[$index] = $value; + } - function offsetUnset($index) { - unset($this->person[$index]); - } + function offsetUnset($index) { + unset($this->person[$index]); + } } $people = new Peoples; @@ -52,7 +52,6 @@ $people[0]['name'] = 'JoeFooBar'; var_dump($people[0]['name']); ?> -===DONE=== --EXPECTF-- string(3) "Joe" string(6) "JoeFoo" @@ -74,4 +73,3 @@ string(6) "JoeFoo" Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_005.php on line 48 string(6) "JoeFoo" -===DONE=== diff --git a/tests/classes/array_access_006.phpt b/tests/classes/array_access_006.phpt index babc808cb4..7891d2aca4 100644 --- a/tests/classes/array_access_006.phpt +++ b/tests/classes/array_access_006.phpt @@ -4,27 +4,27 @@ ZE2 ArrayAccess and ASSIGN_OP operators (+=) <?php class OverloadedArray implements ArrayAccess { - public $realArray; + public $realArray; - function __construct() { - $this->realArray = array(1,2,3); - } + function __construct() { + $this->realArray = array(1,2,3); + } - function offsetExists($index) { - return array_key_exists($this->realArray, $index); - } + function offsetExists($index) { + return array_key_exists($this->realArray, $index); + } - function offsetGet($index) { - return $this->realArray[$index]; - } + function offsetGet($index) { + return $this->realArray[$index]; + } - function offsetSet($index, $value) { - $this->realArray[$index] = $value; - } + function offsetSet($index, $value) { + $this->realArray[$index] = $value; + } - function offsetUnset($index) { - unset($this->realArray[$index]); - } + function offsetUnset($index) { + unset($this->realArray[$index]); + } } $a = new OverloadedArray; diff --git a/tests/classes/array_access_007.phpt b/tests/classes/array_access_007.phpt index 801c8e846c..37a3255d6f 100644 --- a/tests/classes/array_access_007.phpt +++ b/tests/classes/array_access_007.phpt @@ -4,35 +4,35 @@ ZE2 ArrayAccess and [] assignment <?php class OverloadedArray implements ArrayAccess { - public $realArray; - - function __construct() { - $this->realArray = array(); - } - - function offsetExists($index) { - return array_key_exists($this->realArray, $index); - } - - function offsetGet($index) { - return $this->realArray[$index]; - } - - function offsetSet($index, $value) { - if (is_null($index)) { - $this->realArray[] = $value; - } else { - $this->realArray[$index] = $value; - } - } - - function offsetUnset($index) { - unset($this->realArray[$index]); - } - - function dump() { - var_dump($this->realArray); - } + public $realArray; + + function __construct() { + $this->realArray = array(); + } + + function offsetExists($index) { + return array_key_exists($this->realArray, $index); + } + + function offsetGet($index) { + return $this->realArray[$index]; + } + + function offsetSet($index, $value) { + if (is_null($index)) { + $this->realArray[] = $value; + } else { + $this->realArray[$index] = $value; + } + } + + function offsetUnset($index) { + unset($this->realArray[$index]); + } + + function dump() { + var_dump($this->realArray); + } } $a = new OverloadedArray; @@ -42,7 +42,6 @@ $a[2] = 3; $a[] = 4; $a->dump(); ?> -===DONE=== --EXPECT-- array(4) { [0]=> @@ -54,4 +53,3 @@ array(4) { [3]=> int(4) } -===DONE=== diff --git a/tests/classes/array_access_008.phpt b/tests/classes/array_access_008.phpt index 0bb793b2b3..a6f485eb79 100644 --- a/tests/classes/array_access_008.phpt +++ b/tests/classes/array_access_008.phpt @@ -4,27 +4,27 @@ ZE2 ArrayAccess and ASSIGN_OP operators (.=) <?php class Peoples implements ArrayAccess { - public $person; + public $person; - function __construct() { - $this->person = array(array('name'=>'Foo')); - } + function __construct() { + $this->person = array(array('name'=>'Foo')); + } - function offsetExists($index) { - return array_key_exists($this->person, $index); - } + function offsetExists($index) { + return array_key_exists($this->person, $index); + } - function offsetGet($index) { - return $this->person[$index]; - } + function offsetGet($index) { + return $this->person[$index]; + } - function offsetSet($index, $value) { - $this->person[$index] = $value; - } + function offsetSet($index, $value) { + $this->person[$index] = $value; + } - function offsetUnset($index) { - unset($this->person[$index]); - } + function offsetUnset($index) { + unset($this->person[$index]); + } } $people = new Peoples; @@ -48,7 +48,6 @@ $people[0]['name'] .= 'Baz'; var_dump($people[0]['name']); ?> -===DONE=== --EXPECTF-- string(3) "Foo" string(6) "FooBar" @@ -64,4 +63,3 @@ string(3) "Foo" Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 44 string(3) "Foo" -===DONE=== diff --git a/tests/classes/array_access_009.phpt b/tests/classes/array_access_009.phpt index 7da9084d24..a4aeaea56a 100644 --- a/tests/classes/array_access_009.phpt +++ b/tests/classes/array_access_009.phpt @@ -7,92 +7,92 @@ ZE2 ArrayAccess and ArrayProxyAccess, ArrayProxy interface ArrayProxyAccess extends ArrayAccess { - function proxyGet($element); - function proxySet($element, $index, $value); - function proxyUnset($element, $index); + function proxyGet($element); + function proxySet($element, $index, $value); + function proxyUnset($element, $index); } class ArrayProxy implements ArrayAccess { - private $object; - private $element; - - function __construct(ArrayProxyAccess $object, $element) - { - echo __METHOD__ . "($element)\n"; - if (!$object->offsetExists($element)) - { - $object[$element] = array(); - } - $this->object = $object; - $this->element = $element; - } - - function offsetExists($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return array_key_exists($index, $this->object->proxyGet($this->element)); - } - - function offsetGet($index) { - echo __METHOD__ . "($this->element, $index)\n"; - $tmp = $this->object->proxyGet($this->element); - return isset($tmp[$index]) ? $tmp[$index] : NULL; - } - - function offsetSet($index, $value) { - echo __METHOD__ . "($this->element, $index, $value)\n"; - $this->object->proxySet($this->element, $index, $value); - } - - function offsetUnset($index) { - echo __METHOD__ . "($this->element, $index)\n"; - $this->object->proxyUnset($this->element, $index); - } + private $object; + private $element; + + function __construct(ArrayProxyAccess $object, $element) + { + echo __METHOD__ . "($element)\n"; + if (!$object->offsetExists($element)) + { + $object[$element] = array(); + } + $this->object = $object; + $this->element = $element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->object->proxyGet($this->element)); + } + + function offsetGet($index) { + echo __METHOD__ . "($this->element, $index)\n"; + $tmp = $this->object->proxyGet($this->element); + return isset($tmp[$index]) ? $tmp[$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "($this->element, $index, $value)\n"; + $this->object->proxySet($this->element, $index, $value); + } + + function offsetUnset($index) { + echo __METHOD__ . "($this->element, $index)\n"; + $this->object->proxyUnset($this->element, $index); + } } class Peoples implements ArrayProxyAccess { - public $person; - - function __construct() - { - $this->person = array(array('name'=>'Foo')); - } - - function offsetExists($index) - { - return array_key_exists($index, $this->person); - } - - function offsetGet($index) - { - return new ArrayProxy($this, $index); - } - - function offsetSet($index, $value) - { - $this->person[$index] = $value; - } - - function offsetUnset($index) - { - unset($this->person[$index]); - } - - function proxyGet($element) - { - return $this->person[$element]; - } - - function proxySet($element, $index, $value) - { - $this->person[$element][$index] = $value; - } - - function proxyUnset($element, $index) - { - unset($this->person[$element][$index]); - } + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + return new ArrayProxy($this, $index); + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } + + function proxyGet($element) + { + return $this->person[$element]; + } + + function proxySet($element, $index, $value) + { + $this->person[$element][$index] = $value; + } + + function proxyUnset($element, $index) + { + unset($this->person[$element][$index]); + } } $people = new Peoples; @@ -122,7 +122,6 @@ $people[0]['name'] = 'BlaBla'; var_dump($people[0]['name']); ?> -===DONE=== --EXPECTF-- string(3) "Foo" string(6) "FooBar" @@ -187,4 +186,3 @@ ArrayProxy::offsetSet(0, name, BlaBla) ArrayProxy::__construct(0) ArrayProxy::offsetGet(0, name) string(6) "BlaBla" -===DONE=== diff --git a/tests/classes/array_access_010.phpt b/tests/classes/array_access_010.phpt index 3df64fcc7e..f91096c713 100644 --- a/tests/classes/array_access_010.phpt +++ b/tests/classes/array_access_010.phpt @@ -7,65 +7,65 @@ ZE2 ArrayAccess and ArrayReferenceProxy with references class ArrayReferenceProxy implements ArrayAccess { - private $object; - private $element; - - function __construct(ArrayAccess $object, array &$element) - { - echo __METHOD__ . "(Array)\n"; - $this->object = $object; - $this->element = &$element; - } - - function offsetExists($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return array_key_exists($index, $this->element); - } - - function offsetGet($index) { - echo __METHOD__ . "(Array, $index)\n"; - return isset($this->element[$index]) ? $this->element[$index] : NULL; - } - - function offsetSet($index, $value) { - echo __METHOD__ . "(Array, $index, $value)\n"; - $this->element[$index] = $value; - } - - function offsetUnset($index) { - echo __METHOD__ . "(Array, $index)\n"; - unset($this->element[$index]); - } + private $object; + private $element; + + function __construct(ArrayAccess $object, array &$element) + { + echo __METHOD__ . "(Array)\n"; + $this->object = $object; + $this->element = &$element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->element); + } + + function offsetGet($index) { + echo __METHOD__ . "(Array, $index)\n"; + return isset($this->element[$index]) ? $this->element[$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "(Array, $index, $value)\n"; + $this->element[$index] = $value; + } + + function offsetUnset($index) { + echo __METHOD__ . "(Array, $index)\n"; + unset($this->element[$index]); + } } class Peoples implements ArrayAccess { - public $person; - - function __construct() - { - $this->person = array(array('name'=>'Foo')); - } - - function offsetExists($index) - { - return array_key_exists($index, $this->person); - } - - function offsetGet($index) - { - return new ArrayReferenceProxy($this, $this->person[$index]); - } - - function offsetSet($index, $value) - { - $this->person[$index] = $value; - } - - function offsetUnset($index) - { - unset($this->person[$index]); - } + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + return new ArrayReferenceProxy($this, $this->person[$index]); + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } } $people = new Peoples; @@ -95,8 +95,6 @@ $people[0]['name'] = 'BlaBla'; var_dump($people[0]['name']); ?> -===DONE=== -<?php exit(0); ?> --EXPECTF-- string(3) "Foo" string(6) "FooBar" @@ -165,4 +163,3 @@ ArrayReferenceProxy::offsetSet(Array, name, BlaBla) ArrayReferenceProxy::__construct(Array) ArrayReferenceProxy::offsetGet(Array, name) string(6) "BlaBla" -===DONE=== diff --git a/tests/classes/array_access_011.phpt b/tests/classes/array_access_011.phpt index 36269c0b41..3250d64deb 100644 --- a/tests/classes/array_access_011.phpt +++ b/tests/classes/array_access_011.phpt @@ -7,74 +7,74 @@ ZE2 ArrayAccess and ArrayAccessReferenceProxy with references to main array class ArrayAccessReferenceProxy implements ArrayAccess { - private $object; - private $oarray; - private $element; - - function __construct(ArrayAccess $object, array &$array, $element) - { - echo __METHOD__ . "($element)\n"; - $this->object = $object; - $this->oarray = &$array; - $this->element = $element; - } - - function offsetExists($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return array_key_exists($index, $this->oarray[$this->element]); - } - - function offsetGet($index) { - echo __METHOD__ . "($this->element, $index)\n"; - return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL; - } - - function offsetSet($index, $value) { - echo __METHOD__ . "($this->element, $index, $value)\n"; - $this->oarray[$this->element][$index] = $value; - } - - function offsetUnset($index) { - echo __METHOD__ . "($this->element, $index)\n"; - unset($this->oarray[$this->element][$index]); - } + private $object; + private $oarray; + private $element; + + function __construct(ArrayAccess $object, array &$array, $element) + { + echo __METHOD__ . "($element)\n"; + $this->object = $object; + $this->oarray = &$array; + $this->element = $element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->oarray[$this->element]); + } + + function offsetGet($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "($this->element, $index, $value)\n"; + $this->oarray[$this->element][$index] = $value; + } + + function offsetUnset($index) { + echo __METHOD__ . "($this->element, $index)\n"; + unset($this->oarray[$this->element][$index]); + } } class Peoples implements ArrayAccess { - public $person; - - function __construct() - { - $this->person = array(array('name'=>'Foo')); - } - - function offsetExists($index) - { - return array_key_exists($index, $this->person); - } - - function offsetGet($index) - { - if (is_array($this->person[$index])) - { - return new ArrayAccessReferenceProxy($this, $this->person, $index); - } - else - { - return $this->person[$index]; - } - } - - function offsetSet($index, $value) - { - $this->person[$index] = $value; - } - - function offsetUnset($index) - { - unset($this->person[$index]); - } + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + if (is_array($this->person[$index])) + { + return new ArrayAccessReferenceProxy($this, $this->person, $index); + } + else + { + return $this->person[$index]; + } + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } } $people = new Peoples; @@ -104,8 +104,6 @@ $people[0]['name'] = 'BlaBla'; var_dump($people[0]['name']); ?> -===DONE=== -<?php exit(0); ?> --EXPECTF-- string(3) "Foo" string(6) "FooBar" @@ -184,4 +182,3 @@ ArrayAccessReferenceProxy::offsetSet(0, name, BlaBla) ArrayAccessReferenceProxy::__construct(0) ArrayAccessReferenceProxy::offsetGet(0, name) string(6) "BlaBla" -===DONE=== diff --git a/tests/classes/array_access_012.phpt b/tests/classes/array_access_012.phpt index 3cd3dceb8a..e2fba54781 100644 --- a/tests/classes/array_access_012.phpt +++ b/tests/classes/array_access_012.phpt @@ -4,21 +4,21 @@ ZE2 ArrayAccess cannot assign by reference <?php class ArrayAccessImpl implements ArrayAccess { - private $data = array(); + private $data = array(); - public function offsetUnset($index) {} + public function offsetUnset($index) {} - public function offsetSet($index, $value) { - $this->data[$index] = $value; - } + public function offsetSet($index, $value) { + $this->data[$index] = $value; + } - public function offsetGet($index) { - return $this->data[$index]; - } + public function offsetGet($index) { + return $this->data[$index]; + } - public function offsetExists($index) { - return isset($this->data[$index]); - } + public function offsetExists($index) { + return isset($this->data[$index]); + } } $data = new ArrayAccessImpl(); @@ -28,7 +28,6 @@ $data['element'] = &$test; ?> ===DONE=== -<?php exit(0); ?> --EXPECTF-- Notice: Indirect modification of overloaded element of ArrayAccessImpl has no effect in %sarray_access_012.php on line 24 diff --git a/tests/classes/array_access_013.phpt b/tests/classes/array_access_013.phpt index 206d9d5403..bcb6a5e00b 100644 --- a/tests/classes/array_access_013.phpt +++ b/tests/classes/array_access_013.phpt @@ -15,7 +15,7 @@ $t = new Test; try { - echo isset($t[0]); + echo isset($t[0]); } catch(Exception $e) { @@ -24,7 +24,7 @@ catch(Exception $e) try { - echo $t[0]; + echo $t[0]; } catch(Exception $e) { @@ -33,7 +33,7 @@ catch(Exception $e) try { - $t[0] = 1; + $t[0] = 1; } catch(Exception $e) { @@ -42,17 +42,15 @@ catch(Exception $e) try { - unset($t[0]); + unset($t[0]); } catch(Exception $e) { echo "Caught in " . $e->getMessage() . "()\n"; } ?> -===DONE=== --EXPECT-- Caught in Test::offsetExists() Caught in Test::offsetGet() Caught in Test::offsetSet() Caught in Test::offsetUnset() -===DONE=== diff --git a/tests/classes/array_conversion_keys.phpt b/tests/classes/array_conversion_keys.phpt index 6c642f1f85..2267de06d0 100644 --- a/tests/classes/array_conversion_keys.phpt +++ b/tests/classes/array_conversion_keys.phpt @@ -4,9 +4,9 @@ Verifies the correct conversion of objects to arrays <?php class foo { - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; + private $private = 'private'; + protected $protected = 'protected'; + public $public = 'public'; } var_export((array) new foo); ?> diff --git a/tests/classes/assign_op_property_001.phpt b/tests/classes/assign_op_property_001.phpt index cd5fcff469..71f75d2c71 100644 --- a/tests/classes/assign_op_property_001.phpt +++ b/tests/classes/assign_op_property_001.phpt @@ -4,19 +4,19 @@ ZE2 assign_op property of overloaded object <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/autoload_001.phpt b/tests/classes/autoload_001.phpt index 350e1e0f12..cdea16f689 100644 --- a/tests/classes/autoload_001.phpt +++ b/tests/classes/autoload_001.phpt @@ -8,15 +8,13 @@ ZE2 Autoload and class_exists <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_root')); ?> -===DONE=== --EXPECT-- autoload(autoload_root) bool(true) -===DONE=== diff --git a/tests/classes/autoload_002.phpt b/tests/classes/autoload_002.phpt index 1b049c3414..752a9928af 100644 --- a/tests/classes/autoload_002.phpt +++ b/tests/classes/autoload_002.phpt @@ -8,18 +8,16 @@ ZE2 Autoload and get_class_methods <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(get_class_methods('autoload_root')); ?> -===DONE=== --EXPECT-- autoload(autoload_root) array(1) { [0]=> string(12) "testFunction" } -===DONE=== diff --git a/tests/classes/autoload_003.phpt b/tests/classes/autoload_003.phpt index 52fd264d46..05887433c3 100644 --- a/tests/classes/autoload_003.phpt +++ b/tests/classes/autoload_003.phpt @@ -8,16 +8,14 @@ ZE2 Autoload and derived classes <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_derived')); ?> -===DONE=== --EXPECT-- autoload(autoload_root) autoload(autoload_derived) bool(true) -===DONE=== diff --git a/tests/classes/autoload_004.phpt b/tests/classes/autoload_004.phpt index 6f24f157d2..8539e07433 100644 --- a/tests/classes/autoload_004.phpt +++ b/tests/classes/autoload_004.phpt @@ -8,19 +8,17 @@ ZE2 Autoload and recursion <?php spl_autoload_register(function ($class_name) { - var_dump(class_exists($class_name)); - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + var_dump(class_exists($class_name)); + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_derived')); ?> -===DONE=== --EXPECT-- bool(false) bool(false) autoload(autoload_root) autoload(autoload_derived) bool(true) -===DONE=== diff --git a/tests/classes/autoload_005.phpt b/tests/classes/autoload_005.phpt index 67dd23daf7..72d83b88f6 100644 --- a/tests/classes/autoload_005.phpt +++ b/tests/classes/autoload_005.phpt @@ -8,9 +8,9 @@ ZE2 Autoload from destructor <?php spl_autoload_register(function ($class_name) { - var_dump(class_exists($class_name, false)); - require_once(__DIR__ . '/' . $class_name . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + var_dump(class_exists($class_name, false)); + require_once(__DIR__ . '/' . $class_name . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(class_exists('autoload_derived', false)); @@ -29,7 +29,6 @@ $o = new Test; unset($o); ?> -===DONE=== --EXPECTF-- bool(false) bool(false) @@ -40,4 +39,3 @@ autoload(autoload_root) autoload(autoload_derived) object(autoload_derived)#%d (0) { } -===DONE=== diff --git a/tests/classes/autoload_006.phpt b/tests/classes/autoload_006.phpt index 746cbee3f6..f17011ca5e 100644 --- a/tests/classes/autoload_006.phpt +++ b/tests/classes/autoload_006.phpt @@ -8,8 +8,8 @@ ZE2 Autoload from destructor <?php spl_autoload_register(function ($class_name) { - require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); - echo 'autoload(' . $class_name . ")\n"; + require_once(__DIR__ . '/' . strtolower($class_name) . '.inc'); + echo 'autoload(' . $class_name . ")\n"; }); var_dump(interface_exists('autoload_interface', false)); @@ -24,7 +24,6 @@ var_dump(interface_exists('autoload_interface', false)); var_dump(class_exists('autoload_implements', false)); ?> -===DONE=== --EXPECTF-- bool(false) bool(false) @@ -35,4 +34,3 @@ object(autoload_implements)#%d (0) { bool(true) bool(true) bool(true) -===DONE=== diff --git a/tests/classes/autoload_009.phpt b/tests/classes/autoload_009.phpt index 63f1ea9801..6903d9d8ba 100644 --- a/tests/classes/autoload_009.phpt +++ b/tests/classes/autoload_009.phpt @@ -13,7 +13,7 @@ function f(UndefClass $x) f(new stdClass); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: Argument 1 passed to f() must be an instance of UndefClass, instance of stdClass given, called in %s on line %d and defined in %s:%d +Fatal error: Uncaught TypeError: f(): Argument #1 ($x) must be of type UndefClass, stdClass given, called in %s on line %d and defined in %s:%d Stack trace: #0 %s(%d): f(Object(stdClass)) #1 {main} diff --git a/tests/classes/autoload_012.phpt b/tests/classes/autoload_012.phpt index 4fc41c85f5..7a168b3275 100644 --- a/tests/classes/autoload_012.phpt +++ b/tests/classes/autoload_012.phpt @@ -3,12 +3,15 @@ Ensure callback methods in unknown classes trigger autoload. --FILE-- <?php spl_autoload_register(function ($name) { - echo "In autoload: "; - var_dump($name); + echo "In autoload: "; + var_dump($name); }); -call_user_func("UndefC::test"); +try { + call_user_func("UndefC::test"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- In autoload: string(6) "UndefC" - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found in %s on line %d +call_user_func(): Argument #1 ($function) must be a valid callback, class 'UndefC' not found diff --git a/tests/classes/autoload_021.phpt b/tests/classes/autoload_021.phpt index f3dd8ff26d..673813cb2e 100644 --- a/tests/classes/autoload_021.phpt +++ b/tests/classes/autoload_021.phpt @@ -3,7 +3,7 @@ Validation of class names in the autoload process --FILE-- <?php spl_autoload_register(function ($name) { - echo "$name\n"; + echo "$name\n"; }); $a = "../BUG"; $x = new $a; diff --git a/tests/classes/autoload_implements.inc b/tests/classes/autoload_implements.inc index 55fcc3cd9f..e5f19c0680 100644 --- a/tests/classes/autoload_implements.inc +++ b/tests/classes/autoload_implements.inc @@ -1,10 +1,10 @@ <?php class autoload_implements implements autoload_interface { - function testFunction() - { - return true; - } + function testFunction() + { + return true; + } } ?> diff --git a/tests/classes/autoload_interface.inc b/tests/classes/autoload_interface.inc index e6a416e721..6e696f36bf 100644 --- a/tests/classes/autoload_interface.inc +++ b/tests/classes/autoload_interface.inc @@ -1,7 +1,7 @@ <?php interface autoload_interface { - function testFunction(); + function testFunction(); } ?> diff --git a/tests/classes/autoload_root.inc b/tests/classes/autoload_root.inc index 98149c59b5..44200a8d8e 100644 --- a/tests/classes/autoload_root.inc +++ b/tests/classes/autoload_root.inc @@ -1,10 +1,10 @@ <?php class autoload_root { - function testFunction() - { - return true; - } + function testFunction() + { + return true; + } } ?> diff --git a/tests/classes/bug26737.phpt b/tests/classes/bug26737.phpt index e190318ffd..f6f33fbf80 100644 --- a/tests/classes/bug26737.phpt +++ b/tests/classes/bug26737.phpt @@ -4,14 +4,14 @@ Bug #26737 (Protected and private variables are not saved on serialization when <?php class foo { - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; + private $private = 'private'; + protected $protected = 'protected'; + public $public = 'public'; - public function __sleep() - { - return array('private', 'protected', 'public', 'no_such'); - } + public function __sleep() + { + return array('private', 'protected', 'public', 'no_such'); + } } $foo = new foo(); $data = serialize($foo); @@ -19,4 +19,4 @@ var_dump(str_replace("\0", '\0', $data)); ?> --EXPECTF-- Notice: serialize(): "no_such" returned as member variable from __sleep() but does not exist in %s on line %d -string(130) "O:3:"foo":4:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";s:7:"no_such";N;}" +string(114) "O:3:"foo":3:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";}" diff --git a/tests/classes/bug27468.phpt b/tests/classes/bug27468.phpt index 58a7b6cb16..d590683c82 100644 --- a/tests/classes/bug27468.phpt +++ b/tests/classes/bug27468.phpt @@ -3,15 +3,15 @@ Bug #27468 (foreach in __destruct() causes segfault) --FILE-- <?php class foo { - function __destruct() { - foreach ($this->x as $x); - } + function __destruct() { + foreach ($this->x as $x); + } } new foo(); echo 'OK'; ?> --EXPECTF-- -Notice: Undefined property: foo::$x in %sbug27468.php on line 4 +Warning: Undefined property: foo::$x in %s on line %d -Warning: Invalid argument supplied for foreach() in %sbug27468.php on line 4 +Warning: foreach() argument must be of type array|object, null given in %sbug27468.php on line 4 OK diff --git a/tests/classes/bug27504.phpt b/tests/classes/bug27504.phpt index ba44806bfe..74d14c8a40 100644 --- a/tests/classes/bug27504.phpt +++ b/tests/classes/bug27504.phpt @@ -2,27 +2,30 @@ Bug #27504 (call_user_func_array allows calling of private/protected methods) --FILE-- <?php - class foo { - function __construct () { - $this->bar('1'); - } - private function bar ( $param ) { - echo 'Called function foo:bar('.$param.')'."\n"; - } - } +class foo { + function __construct () { + $this->bar('1'); + } + private function bar ( $param ) { + echo 'Called function foo:bar('.$param.')'."\n"; + } +} - $foo = new foo(); +$foo = new foo(); - call_user_func_array( array( $foo , 'bar' ) , array( '2' ) ); +try { + call_user_func_array( array( $foo , 'bar' ) , array( '2' ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + $foo->bar('3'); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} - $foo->bar('3'); ?> ---EXPECTF-- +--EXPECT-- Called function foo:bar(1) - -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: Uncaught Error: Call to private method foo::bar() from context '' in %s:%d -Stack trace: -#0 {main} - thrown in %s on line %d +call_user_func_array(): Argument #1 ($function) must be a valid callback, cannot access private method foo::bar() +Call to private method foo::bar() from context '' diff --git a/tests/classes/bug75765.phpt b/tests/classes/bug75765.phpt index 650ca65e96..b3c8a17f6f 100644 --- a/tests/classes/bug75765.phpt +++ b/tests/classes/bug75765.phpt @@ -4,11 +4,11 @@ Ensure that extending of undefined class throws the exception <?php try { - class A extends B {} + class A extends B {} } catch (Error $e) { - var_dump(class_exists('A')); - var_dump(class_exists('B')); - throw $e; + var_dump(class_exists('A')); + var_dump(class_exists('B')); + throw $e; } ?> diff --git a/tests/classes/class_abstract.phpt b/tests/classes/class_abstract.phpt index d852884d52..2d5b4630c4 100644 --- a/tests/classes/class_abstract.phpt +++ b/tests/classes/class_abstract.phpt @@ -4,9 +4,9 @@ ZE2 An abstract class cannot be instantiated <?php abstract class base { - function show() { - echo "base\n"; - } + function show() { + echo "base\n"; + } } class derived extends base { diff --git a/tests/classes/class_final.phpt b/tests/classes/class_final.phpt index 45cbc72751..885b565952 100644 --- a/tests/classes/class_final.phpt +++ b/tests/classes/class_final.phpt @@ -4,9 +4,9 @@ ZE2 A final class cannot be inherited <?php final class base { - function show() { - echo "base\n"; - } + function show() { + echo "base\n"; + } } $t = new base(); diff --git a/tests/classes/clone_001.phpt b/tests/classes/clone_001.phpt index e1d200be26..ac026e551a 100644 --- a/tests/classes/clone_001.phpt +++ b/tests/classes/clone_001.phpt @@ -3,9 +3,9 @@ ZE2 object cloning, 1 --FILE-- <?php class test { - public $p1 = 1; - public $p2 = 2; - public $p3; + public $p1 = 1; + public $p2 = 2; + public $p3; }; $obj = new test; diff --git a/tests/classes/clone_002.phpt b/tests/classes/clone_002.phpt index b2f73b4b80..7bca4392b7 100644 --- a/tests/classes/clone_002.phpt +++ b/tests/classes/clone_002.phpt @@ -3,11 +3,11 @@ ZE2 object cloning, 2 --FILE-- <?php class test { - public $p1 = 1; - public $p2 = 2; - public $p3; - public function __clone() { - } + public $p1 = 1; + public $p2 = 2; + public $p3; + public function __clone() { + } }; $obj = new test; diff --git a/tests/classes/clone_003.phpt b/tests/classes/clone_003.phpt index e595a59066..30d4cc549a 100644 --- a/tests/classes/clone_003.phpt +++ b/tests/classes/clone_003.phpt @@ -3,24 +3,24 @@ ZE2 object cloning, 3 --FILE-- <?php class base { - protected $p1 = 'base:1'; - public $p2 = 'base:2'; - public $p3 = 'base:3'; - public $p4 = 'base:4'; - public $p5 = 'base:5'; - private $p6 = 'base:6'; - public function __clone() { - } + protected $p1 = 'base:1'; + public $p2 = 'base:2'; + public $p3 = 'base:3'; + public $p4 = 'base:4'; + public $p5 = 'base:5'; + private $p6 = 'base:6'; + public function __clone() { + } }; class test extends base { - public $p1 = 'test:1'; - public $p3 = 'test:3'; - public $p4 = 'test:4'; - public $p5 = 'test:5'; - public function __clone() { - $this->p5 = 'clone:5'; - } + public $p1 = 'test:1'; + public $p3 = 'test:3'; + public $p4 = 'test:4'; + public $p5 = 'test:5'; + public function __clone() { + $this->p5 = 'clone:5'; + } } $obj = new test; diff --git a/tests/classes/clone_004.phpt b/tests/classes/clone_004.phpt index 88ad916bb4..610a00e702 100644 --- a/tests/classes/clone_004.phpt +++ b/tests/classes/clone_004.phpt @@ -16,7 +16,7 @@ class test extends base { public function __clone() {} public function show() { - var_dump($this); + var_dump($this); } } diff --git a/tests/classes/clone_006.phpt b/tests/classes/clone_006.phpt index d8a6140358..16f6bfe508 100644 --- a/tests/classes/clone_006.phpt +++ b/tests/classes/clone_006.phpt @@ -6,16 +6,16 @@ error_reporting=2047 <?php class MyCloneable { - static $id = 0; + static $id = 0; - function __construct() { - $this->id = self::$id++; - } + function __construct() { + $this->id = self::$id++; + } - function __clone() { - $this->address = "New York"; - $this->id = self::$id++; - } + function __clone() { + $this->address = "New York"; + $this->id = self::$id++; + } } $original = new MyCloneable(); diff --git a/tests/classes/constants_basic_001.phpt b/tests/classes/constants_basic_001.phpt index 6a281e7d32..c052d35701 100644 --- a/tests/classes/constants_basic_001.phpt +++ b/tests/classes/constants_basic_001.phpt @@ -9,8 +9,6 @@ Class constant declarations class C { - const c0 = UNDEFINED; - const c1 = 1, c2 = 1.5; const c3 = + 1, c4 = + 1.5; const c5 = -1, c6 = -1.5; @@ -32,7 +30,6 @@ Class constant declarations } echo "\nAttempt to access various kinds of class constants:\n"; - var_dump(C::c0); var_dump(C::c1); var_dump(C::c2); var_dump(C::c3); @@ -58,19 +55,16 @@ Class constant declarations echo "\nYou should not see this."; ?> --EXPECTF-- -Notice: Undefined variable: undef in %s on line 5 +Warning: Undefined variable $undef in %s on line %d Attempt to access various kinds of class constants: - -Warning: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s on line %d -string(9) "UNDEFINED" int(1) float(1.5) int(1) float(1.5) int(-1) float(-1.5) -int(15) +int(13) string(%d) "%s" string(1) "C" string(0) "" @@ -85,7 +79,7 @@ string(6) "hello2" Expecting fatal error: -Fatal error: Uncaught Error: Undefined class constant 'c19' in %s:53 +Fatal error: Uncaught Error: Undefined class constant 'C::c19' in %s:%d Stack trace: #0 {main} - thrown in %s on line 53 + thrown in %s on line %d diff --git a/tests/classes/constants_basic_002.phpt b/tests/classes/constants_basic_002.phpt index def661ec45..88c66aaee8 100644 --- a/tests/classes/constants_basic_002.phpt +++ b/tests/classes/constants_basic_002.phpt @@ -23,7 +23,7 @@ string(5) "hello" Fail to read class constant from instance. -Notice: Undefined property: aclass::$myConst in %s on line 12 +Warning: Undefined property: aclass::$myConst in %s on line %d NULL Class constant not visible in object var_dump. diff --git a/tests/classes/constants_basic_003.inc b/tests/classes/constants_basic_003.inc index 17e067b534..c7439f460a 100644 --- a/tests/classes/constants_basic_003.inc +++ b/tests/classes/constants_basic_003.inc @@ -1,5 +1,5 @@ <?php class A { - const MY_CONST = "hello from A"; + const MY_CONST = "hello from A"; } ?> diff --git a/tests/classes/constants_comments_001.phpt b/tests/classes/constants_comments_001.phpt index 297ad9f956..46bf4fafff 100644 --- a/tests/classes/constants_comments_001.phpt +++ b/tests/classes/constants_comments_001.phpt @@ -5,22 +5,22 @@ opcache.save_comments=1 --FILE-- <?php class X { - /** comment X1 */ - const X1 = 1; - const X2 = 2; - /** comment X3 */ - const X3 = 3; + /** comment X1 */ + const X1 = 1; + const X2 = 2; + /** comment X3 */ + const X3 = 3; } class Y extends X { - /** comment Y1 */ - const Y1 = 1; - const Y2 = 2; - /** comment Y3 */ - const Y3 = 3; + /** comment Y1 */ + const Y1 = 1; + const Y2 = 2; + /** comment Y3 */ + const Y3 = 3; } $r = new ReflectionClass('Y'); foreach ($r->getReflectionConstants() as $rc) { - echo $rc->getName() . " : " . $rc->getDocComment() . "\n"; + echo $rc->getName() . " : " . $rc->getDocComment() . "\n"; } diff --git a/tests/classes/constants_error_003.phpt b/tests/classes/constants_error_003.phpt index fa7984f06e..a0ee23506b 100644 --- a/tests/classes/constants_error_003.phpt +++ b/tests/classes/constants_error_003.phpt @@ -16,4 +16,7 @@ Basic class support - attempting to pass a class constant by reference. var_dump(aclass::myConst); ?> --EXPECTF-- -Fatal error: Only variables can be passed by reference in %s on line 12 +Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/tests/classes/constants_scope_001.phpt b/tests/classes/constants_scope_001.phpt index 7adf3f8681..54fc8c4a00 100644 --- a/tests/classes/constants_scope_001.phpt +++ b/tests/classes/constants_scope_001.phpt @@ -4,21 +4,20 @@ ZE2 class constants and scope <?php class ErrorCodes { - const FATAL = "Fatal error\n"; - const WARNING = "Warning\n"; - const INFO = "Informational message\n"; + const FATAL = "Fatal error\n"; + const WARNING = "Warning\n"; + const INFO = "Informational message\n"; - static function print_fatal_error_codes() { - echo "FATAL = " . FATAL . "\n"; - echo "self::FATAL = " . self::FATAL; + static function print_fatal_error_codes() { + echo "self::FATAL = " . self::FATAL; } } class ErrorCodesDerived extends ErrorCodes { - const FATAL = "Worst error\n"; - static function print_fatal_error_codes() { - echo "self::FATAL = " . self::FATAL; - echo "parent::FATAL = " . parent::FATAL; + const FATAL = "Worst error\n"; + static function print_fatal_error_codes() { + echo "self::FATAL = " . self::FATAL; + echo "parent::FATAL = " . parent::FATAL; } } @@ -27,9 +26,7 @@ ErrorCodes::print_fatal_error_codes(); ErrorCodesDerived::print_fatal_error_codes(); ?> ---EXPECTF-- -Warning: Use of undefined constant FATAL - assumed 'FATAL' (this will throw an Error in a future version of PHP) in %sconstants_scope_001.php on line %d -FATAL = FATAL +--EXPECT-- self::FATAL = Fatal error self::FATAL = Worst error parent::FATAL = Fatal error diff --git a/tests/classes/constants_visibility_001.phpt b/tests/classes/constants_visibility_001.phpt index a5eeb47f37..b57fd82127 100644 --- a/tests/classes/constants_visibility_001.phpt +++ b/tests/classes/constants_visibility_001.phpt @@ -3,13 +3,13 @@ Class public constant visibility --FILE-- <?php class A { - public const publicConst = 'publicConst'; - static function staticConstDump() { - var_dump(self::publicConst); - } - function constDump() { - var_dump(self::publicConst); - } + public const publicConst = 'publicConst'; + static function staticConstDump() { + var_dump(self::publicConst); + } + function constDump() { + var_dump(self::publicConst); + } } var_dump(A::publicConst); diff --git a/tests/classes/constants_visibility_002.phpt b/tests/classes/constants_visibility_002.phpt index 4e0ecb1aa2..58c35b7a4a 100644 --- a/tests/classes/constants_visibility_002.phpt +++ b/tests/classes/constants_visibility_002.phpt @@ -3,22 +3,25 @@ Class protected constant visibility --FILE-- <?php class A { - protected const protectedConst = 'protectedConst'; - static function staticConstDump() { - var_dump(self::protectedConst); - } - function constDump() { - var_dump(self::protectedConst); - } + protected const protectedConst = 'protectedConst'; + static function staticConstDump() { + var_dump(self::protectedConst); + } + function constDump() { + var_dump(self::protectedConst); + } } A::staticConstDump(); (new A())->constDump(); -constant('A::protectedConst'); +try { + constant('A::protectedConst'); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- string(14) "protectedConst" string(14) "protectedConst" - -Warning: constant(): Couldn't find constant A::protectedConst in %s on line %d +Cannot access protected const A::protectedConst diff --git a/tests/classes/constants_visibility_003.phpt b/tests/classes/constants_visibility_003.phpt index 7c961695ed..7492af90df 100644 --- a/tests/classes/constants_visibility_003.phpt +++ b/tests/classes/constants_visibility_003.phpt @@ -3,22 +3,25 @@ Class private constant visibility --FILE-- <?php class A { - private const privateConst = 'privateConst'; - static function staticConstDump() { - var_dump(self::privateConst); - } - function constDump() { - var_dump(self::privateConst); - } + private const privateConst = 'privateConst'; + static function staticConstDump() { + var_dump(self::privateConst); + } + function constDump() { + var_dump(self::privateConst); + } } A::staticConstDump(); (new A())->constDump(); -constant('A::privateConst'); +try { + constant('A::privateConst'); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- string(12) "privateConst" string(12) "privateConst" - -Warning: constant(): Couldn't find constant A::privateConst in %s on line %d +Cannot access private const A::privateConst diff --git a/tests/classes/constants_visibility_004.phpt b/tests/classes/constants_visibility_004.phpt index 93acacf3c9..d35597b365 100644 --- a/tests/classes/constants_visibility_004.phpt +++ b/tests/classes/constants_visibility_004.phpt @@ -3,16 +3,16 @@ Only public and protected class constants should be inherited --FILE-- <?php class A { - public const X = 1; - protected const Y = 2; - private const Z = 3; + public const X = 1; + protected const Y = 2; + private const Z = 3; } class B extends A { - static public function checkConstants() { - var_dump(self::X); - var_dump(self::Y); - var_dump(self::Z); - } + static public function checkConstants() { + var_dump(self::X); + var_dump(self::Y); + var_dump(self::Z); + } } B::checkConstants(); @@ -21,7 +21,7 @@ B::checkConstants(); int(1) int(2) -Fatal error: Uncaught Error: Undefined class constant 'Z' in %s:11 +Fatal error: Uncaught Error: Undefined class constant 'B::Z' in %s:11 Stack trace: #0 %s(15): B::checkConstants() #1 {main} diff --git a/tests/classes/constants_visibility_005.phpt b/tests/classes/constants_visibility_005.phpt index 813009c675..ff5c10ca13 100644 --- a/tests/classes/constants_visibility_005.phpt +++ b/tests/classes/constants_visibility_005.phpt @@ -3,7 +3,7 @@ Static constants are not allowed --FILE-- <?php class A { - static const X = 1; + static const X = 1; } ?> --EXPECTF-- diff --git a/tests/classes/constants_visibility_006.phpt b/tests/classes/constants_visibility_006.phpt index a3317cca8a..46300abf40 100644 --- a/tests/classes/constants_visibility_006.phpt +++ b/tests/classes/constants_visibility_006.phpt @@ -3,7 +3,7 @@ Abstract constants are not allowed --FILE-- <?php class A { - abstract const X = 1; + abstract const X = 1; } ?> --EXPECTF-- diff --git a/tests/classes/constants_visibility_007.phpt b/tests/classes/constants_visibility_007.phpt index f1b040c5c3..37b5285586 100644 --- a/tests/classes/constants_visibility_007.phpt +++ b/tests/classes/constants_visibility_007.phpt @@ -3,7 +3,7 @@ Final constants are not allowed --FILE-- <?php class A { - final const X = 1; + final const X = 1; } ?> --EXPECTF-- diff --git a/tests/classes/constants_visibility_error_001.phpt b/tests/classes/constants_visibility_error_001.phpt index 397dd24882..35ccf1e83d 100644 --- a/tests/classes/constants_visibility_error_001.phpt +++ b/tests/classes/constants_visibility_error_001.phpt @@ -3,7 +3,7 @@ Class private constant visibility error --FILE-- <?php class A { - private const privateConst = 'privateConst'; + private const privateConst = 'privateConst'; } var_dump(A::privateConst); diff --git a/tests/classes/constants_visibility_error_002.phpt b/tests/classes/constants_visibility_error_002.phpt index 2980b52c37..2068862942 100644 --- a/tests/classes/constants_visibility_error_002.phpt +++ b/tests/classes/constants_visibility_error_002.phpt @@ -3,7 +3,7 @@ Class protected constant visibility error --FILE-- <?php class A { - protected const protectedConst = 'protectedConst'; + protected const protectedConst = 'protectedConst'; } var_dump(A::protectedConst); diff --git a/tests/classes/constants_visibility_error_003.phpt b/tests/classes/constants_visibility_error_003.phpt index 6f62069c2e..c7a8b3139f 100644 --- a/tests/classes/constants_visibility_error_003.phpt +++ b/tests/classes/constants_visibility_error_003.phpt @@ -4,11 +4,11 @@ A redeclared class constant must have the same or higher visibility <?php class A { - public const publicConst = 0; + public const publicConst = 0; } class B extends A { - protected const publicConst = 1; + protected const publicConst = 1; } --EXPECTF-- Fatal error: Access level to B::publicConst must be public (as in class A) in %s on line 9 diff --git a/tests/classes/constants_visibility_error_004.phpt b/tests/classes/constants_visibility_error_004.phpt index 65bfbd3c2b..6fde322cdd 100644 --- a/tests/classes/constants_visibility_error_004.phpt +++ b/tests/classes/constants_visibility_error_004.phpt @@ -4,11 +4,11 @@ A redeclared class constant must have the same or higher visibility <?php class A { - protected const protectedConst = 0; + protected const protectedConst = 0; } class B extends A { - private const protectedConst = 1; + private const protectedConst = 1; } --EXPECTF-- Fatal error: Access level to B::protectedConst must be protected (as in class A) or weaker in %s on line 9 diff --git a/tests/classes/ctor_dtor.phpt b/tests/classes/ctor_dtor.phpt index bcac143025..3a40f7f568 100644 --- a/tests/classes/ctor_dtor.phpt +++ b/tests/classes/ctor_dtor.phpt @@ -4,21 +4,21 @@ ZE2 The new constructor/destructor is called <?php class early { - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } + function __construct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } + function __destruct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } } class late { - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } + function __construct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } + function __destruct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + } } $t = new early(); diff --git a/tests/classes/ctor_dtor_inheritance.phpt b/tests/classes/ctor_dtor_inheritance.phpt index 1f3d3483d0..bd1414c8b8 100644 --- a/tests/classes/ctor_dtor_inheritance.phpt +++ b/tests/classes/ctor_dtor_inheritance.phpt @@ -9,38 +9,38 @@ ZE2 A derived class can use the inherited constructor/destructor // - base class constructors/destructors know the instantiated class name class base { - public $name; + public $name; - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - $this->name = 'base'; - print_r($this); - } + function __construct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + $this->name = 'base'; + print_r($this); + } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - print_r($this); - } + function __destruct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + print_r($this); + } } class derived extends base { - public $other; + public $other; - function __construct() { - $this->name = 'init'; - $this->other = 'other'; - print_r($this); - parent::__construct(); - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - $this->name = 'derived'; - print_r($this); - } + function __construct() { + $this->name = 'init'; + $this->other = 'other'; + print_r($this); + parent::__construct(); + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + $this->name = 'derived'; + print_r($this); + } - function __destruct() { - parent::__destruct(); - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - print_r($this); - } + function __destruct() { + parent::__destruct(); + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + print_r($this); + } } echo "Testing class base\n"; diff --git a/tests/classes/ctor_failure.phpt b/tests/classes/ctor_failure.phpt index f86b0cc5f8..9497482892 100644 --- a/tests/classes/ctor_failure.phpt +++ b/tests/classes/ctor_failure.phpt @@ -26,8 +26,6 @@ catch (Exception $e) } ?> -===DONE=== --EXPECT-- Test::__construct(Hello) Caught Exception(Hello) -===DONE=== diff --git a/tests/classes/ctor_in_interface_01.phpt b/tests/classes/ctor_in_interface_01.phpt index fc97371f6f..e1ef717f90 100644 --- a/tests/classes/ctor_in_interface_01.phpt +++ b/tests/classes/ctor_in_interface_01.phpt @@ -4,14 +4,14 @@ ZE2 A class constructor must keep the signature of an interface <?php interface constr { - function __construct(); + function __construct(); } class implem implements constr { - function __construct($a) - { - } + function __construct($a) + { + } } ?> diff --git a/tests/classes/ctor_in_interface_02.phpt b/tests/classes/ctor_in_interface_02.phpt index 08e6f36e0e..3484432eae 100644 --- a/tests/classes/ctor_in_interface_02.phpt +++ b/tests/classes/ctor_in_interface_02.phpt @@ -4,7 +4,7 @@ ZE2 A class constructor must keep the signature of all interfaces <?php interface constr1 { - function __construct(); + function __construct(); } interface constr2 extends constr1 @@ -13,21 +13,21 @@ interface constr2 extends constr1 class implem12 implements constr2 { - function __construct() - { - } + function __construct() + { + } } interface constr3 { - function __construct($a); + function __construct($a); } class implem13 implements constr1, constr3 { - function __construct() - { - } + function __construct() + { + } } ?> --EXPECTF-- diff --git a/tests/classes/ctor_in_interface_03.phpt b/tests/classes/ctor_in_interface_03.phpt index 25d7f9dc82..42c70764b9 100644 --- a/tests/classes/ctor_in_interface_03.phpt +++ b/tests/classes/ctor_in_interface_03.phpt @@ -4,7 +4,7 @@ ZE2 A class constructor must keep the signature of base class interfaces <?php interface constr { - function __construct(); + function __construct(); } abstract class implem implements constr @@ -13,9 +13,9 @@ abstract class implem implements constr class derived extends implem { - function __construct($a) - { - } + function __construct($a) + { + } } ?> diff --git a/tests/classes/ctor_in_interface_04.phpt b/tests/classes/ctor_in_interface_04.phpt index 0b07f9a1ca..2bc532f434 100644 --- a/tests/classes/ctor_in_interface_04.phpt +++ b/tests/classes/ctor_in_interface_04.phpt @@ -4,21 +4,21 @@ ZE2 A class constructor must keep the signature of base class interfaces <?php interface constr { - function __construct(); + function __construct(); } class implem implements constr { - function __construct() - { - } + function __construct() + { + } } class derived extends implem { - function __construct($a) - { - } + function __construct($a) + { + } } ?> diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt deleted file mode 100644 index e6518775ff..0000000000 --- a/tests/classes/ctor_name_clash.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ZE2 The child class can re-use the parent class name for a function member ---FILE-- -<?php -class base { - function base() { - echo __CLASS__."::".__FUNCTION__."\n"; - } -} - -class derived extends base { - function base() { - echo __CLASS__."::".__FUNCTION__."\n"; - } -} - -$obj = new derived(); -$obj->base(); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; base has a deprecated constructor in %s on line %d -base::base -derived::base diff --git a/tests/classes/ctor_visibility.phpt b/tests/classes/ctor_visibility.phpt index 685c7dbe41..6316ed5e12 100644 --- a/tests/classes/ctor_visibility.phpt +++ b/tests/classes/ctor_visibility.phpt @@ -13,16 +13,16 @@ class Test class Derived extends Test { - function __construct() - { + function __construct() + { echo __METHOD__ . "()\n"; - parent::__construct(); - } + parent::__construct(); + } - static function f() - { - new Derived; - } + static function f() + { + new Derived; + } } Derived::f(); @@ -34,26 +34,26 @@ class TestPriv echo __METHOD__ . "()\n"; } - static function f() - { - new TestPriv; - } + static function f() + { + new TestPriv; + } } TestPriv::f(); class DerivedPriv extends TestPriv { - function __construct() - { + function __construct() + { echo __METHOD__ . "()\n"; - parent::__construct(); - } + parent::__construct(); + } - static function f() - { - new DerivedPriv; - } + static function f() + { + new DerivedPriv; + } } DerivedPriv::f(); diff --git a/tests/classes/dereferencing_001.phpt b/tests/classes/dereferencing_001.phpt index e7e90cf5e3..4ec2a87659 100644 --- a/tests/classes/dereferencing_001.phpt +++ b/tests/classes/dereferencing_001.phpt @@ -4,25 +4,25 @@ ZE2 dereferencing of objects from methods <?php class Name { - function __construct($_name) { - $this->name = $_name; - } + function __construct($_name) { + $this->name = $_name; + } - function display() { - echo $this->name . "\n"; - } + function display() { + echo $this->name . "\n"; + } } class Person { - private $name; + private $name; - function __construct($_name, $_address) { - $this->name = new Name($_name); - } + function __construct($_name, $_address) { + $this->name = new Name($_name); + } - function getName() { - return $this->name; - } + function getName() { + return $this->name; + } } $person = new Person("John", "New York"); diff --git a/tests/classes/destructor_and_exceptions.phpt b/tests/classes/destructor_and_exceptions.phpt index 0da6e642af..0f51a21a09 100644 --- a/tests/classes/destructor_and_exceptions.phpt +++ b/tests/classes/destructor_and_exceptions.phpt @@ -5,56 +5,54 @@ ZE2 catch exception thrown in destructor class FailClass { - public $fatal; + public $fatal; - function __destruct() - { - echo __METHOD__ . "\n"; - throw new exception("FailClass"); - echo "Done: " . __METHOD__ . "\n"; - } + function __destruct() + { + echo __METHOD__ . "\n"; + throw new exception("FailClass"); + echo "Done: " . __METHOD__ . "\n"; + } } try { - $a = new FailClass; - unset($a); + $a = new FailClass; + unset($a); } catch(Exception $e) { - echo "Caught: " . $e->getMessage() . "\n"; + echo "Caught: " . $e->getMessage() . "\n"; } class FatalException extends Exception { - function __construct($what) - { - echo __METHOD__ . "\n"; - $o = new FailClass; - unset($o); - echo "Done: " . __METHOD__ . "\n"; - } + function __construct($what) + { + echo __METHOD__ . "\n"; + $o = new FailClass; + unset($o); + echo "Done: " . __METHOD__ . "\n"; + } } try { - throw new FatalException("Damn"); + throw new FatalException("Damn"); } catch(Exception $e) { - echo "Caught Exception: " . $e->getMessage() . "\n"; + echo "Caught Exception: " . $e->getMessage() . "\n"; } catch(FatalException $e) { - echo "Caught FatalException: " . $e->getMessage() . "\n"; + echo "Caught FatalException: " . $e->getMessage() . "\n"; } ?> -===DONE=== --EXPECT-- FailClass::__destruct Caught: FailClass FatalException::__construct FailClass::__destruct Caught Exception: FailClass -===DONE=== diff --git a/tests/classes/destructor_and_globals.phpt b/tests/classes/destructor_and_globals.phpt index 1276d28348..5e0773b00c 100644 --- a/tests/classes/destructor_and_globals.phpt +++ b/tests/classes/destructor_and_globals.phpt @@ -30,8 +30,8 @@ class counter { } static public function destroy(&$obj) { - $obj = NULL; - } + $obj = NULL; + } } Show(); $obj1 = new counter; diff --git a/tests/classes/destructor_visibility_001.phpt b/tests/classes/destructor_visibility_001.phpt index b48d000f91..41def0e525 100644 --- a/tests/classes/destructor_visibility_001.phpt +++ b/tests/classes/destructor_visibility_001.phpt @@ -4,9 +4,9 @@ ZE2 Ensuring destructor visibility <?php class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } + private function __destruct() { + echo __METHOD__ . "\n"; + } } class Derived extends Base { diff --git a/tests/classes/destructor_visibility_002.phpt b/tests/classes/destructor_visibility_002.phpt index 96cf275a7c..227cc1aff0 100644 --- a/tests/classes/destructor_visibility_002.phpt +++ b/tests/classes/destructor_visibility_002.phpt @@ -4,9 +4,9 @@ ZE2 Ensuring destructor visibility <?php class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } + private function __destruct() { + echo __METHOD__ . "\n"; + } } class Derived extends Base { diff --git a/tests/classes/destructor_visibility_003.phpt b/tests/classes/destructor_visibility_003.phpt index c0235cd1e3..78551a7e01 100644 --- a/tests/classes/destructor_visibility_003.phpt +++ b/tests/classes/destructor_visibility_003.phpt @@ -4,15 +4,15 @@ ZE2 Ensuring destructor visibility <?php class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } + private function __destruct() { + echo __METHOD__ . "\n"; + } } class Derived extends Base { - public function __destruct() { - echo __METHOD__ . "\n"; - } + public function __destruct() { + echo __METHOD__ . "\n"; + } } $obj = new Derived; @@ -20,7 +20,5 @@ $obj = new Derived; unset($obj); // Derived::__destruct is being called not Base::__destruct ?> -===DONE=== --EXPECT-- Derived::__destruct -===DONE=== diff --git a/tests/classes/factory_001.phpt b/tests/classes/factory_001.phpt index 45f97331a5..96af2acef7 100644 --- a/tests/classes/factory_001.phpt +++ b/tests/classes/factory_001.phpt @@ -4,24 +4,24 @@ ZE2 factory objects <?php class Circle { - function draw() { - echo "Circle\n"; - } + function draw() { + echo "Circle\n"; + } } class Square { - function draw() { - print "Square\n"; - } + function draw() { + print "Square\n"; + } } function ShapeFactoryMethod($shape) { - switch ($shape) { - case "Circle": - return new Circle(); - case "Square": - return new Square(); - } + switch ($shape) { + case "Circle": + return new Circle(); + case "Square": + return new Square(); + } } ShapeFactoryMethod("Circle")->draw(); diff --git a/tests/classes/factory_and_singleton_001.phpt b/tests/classes/factory_and_singleton_001.phpt index dbbf07cfad..ead7d480cd 100644 --- a/tests/classes/factory_and_singleton_001.phpt +++ b/tests/classes/factory_and_singleton_001.phpt @@ -27,7 +27,7 @@ class test { } protected function __destruct() { - test::$cnt--; + test::$cnt--; } public function get() { diff --git a/tests/classes/factory_and_singleton_002.phpt b/tests/classes/factory_and_singleton_002.phpt index 6748321242..c4132f9d38 100644 --- a/tests/classes/factory_and_singleton_002.phpt +++ b/tests/classes/factory_and_singleton_002.phpt @@ -27,7 +27,7 @@ class test { } protected function __destruct() { - test::$cnt--; + test::$cnt--; } public function get() { diff --git a/tests/classes/factory_and_singleton_009.phpt b/tests/classes/factory_and_singleton_009.phpt index c1cfcbdcdf..7795ea4a79 100644 --- a/tests/classes/factory_and_singleton_009.phpt +++ b/tests/classes/factory_and_singleton_009.phpt @@ -5,7 +5,7 @@ ZE2 factory and singleton, test 9 class test { protected function __destruct() { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; } } diff --git a/tests/classes/factory_and_singleton_010.phpt b/tests/classes/factory_and_singleton_010.phpt index 9466fe55e4..a816b3f60f 100644 --- a/tests/classes/factory_and_singleton_010.phpt +++ b/tests/classes/factory_and_singleton_010.phpt @@ -5,7 +5,7 @@ ZE2 factory and singleton, test 10 class test { private function __destruct() { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; } } diff --git a/tests/classes/final.phpt b/tests/classes/final.phpt index 0e100d2304..75be8ec2f4 100644 --- a/tests/classes/final.phpt +++ b/tests/classes/final.phpt @@ -4,18 +4,18 @@ ZE2 A method may be redeclared final <?php class first { - function show() { - echo "Call to function first::show()\n"; - } + function show() { + echo "Call to function first::show()\n"; + } } $t = new first(); $t->show(); class second extends first { - final function show() { - echo "Call to function second::show()\n"; - } + final function show() { + echo "Call to function second::show()\n"; + } } $t2 = new second(); diff --git a/tests/classes/final_abstract.phpt b/tests/classes/final_abstract.phpt index 229ae896b0..66f5c87a6f 100644 --- a/tests/classes/final_abstract.phpt +++ b/tests/classes/final_abstract.phpt @@ -4,7 +4,7 @@ ZE2 A final method cannot be abstract <?php class fail { - final abstract function show(); + final abstract function show(); } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt index acf20918fd..092dd146d4 100644 --- a/tests/classes/final_ctor1.phpt +++ b/tests/classes/final_ctor1.phpt @@ -5,9 +5,9 @@ ZE2 cannot override final __construct class Base { - public final function __construct() - { - } + public final function __construct() + { + } } class Works extends Base @@ -16,15 +16,11 @@ class Works extends Base class Extended extends Base { - public function Extended() - { - } + public function __construct() + { + } } -ReflectionClass::export('Extended'); - ?> --EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Extended has a deprecated constructor in %s on line %d - -Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d +Fatal error: Cannot override final method Base::__construct() in %s on line %d diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt deleted file mode 100644 index 37fcac29a9..0000000000 --- a/tests/classes/final_ctor2.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ZE2 cannot override final old style ctor ---FILE-- -<?php - -class Base -{ - public final function Base() - { - } -} - -class Works extends Base -{ -} - -class Extended extends Base -{ - public function __construct() - { - } -} - -ReflectionClass::export('Extended'); - -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base has a deprecated constructor in %s on line %d - -Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt deleted file mode 100644 index b0156ef294..0000000000 --- a/tests/classes/final_ctor3.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Ensure implicit final inherited old-style constructor cannot be overridden. ---FILE-- -<?php - class A { - final function A() { } - } - class B extends A { - function A() { } - } -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d - -Fatal error: Cannot override final method A::A() in %s on line 6 diff --git a/tests/classes/final_redeclare.phpt b/tests/classes/final_redeclare.phpt index d3d53c5dc7..e6dc38b908 100644 --- a/tests/classes/final_redeclare.phpt +++ b/tests/classes/final_redeclare.phpt @@ -4,17 +4,17 @@ ZE2 A final method may not be overwritten <?php class pass { - final function show() { - echo "Call to function pass::show()\n"; - } + final function show() { + echo "Call to function pass::show()\n"; + } } $t = new pass(); class fail extends pass { - function show() { - echo "Call to function fail::show()\n"; - } + function show() { + echo "Call to function fail::show()\n"; + } } echo "Done\n"; // Shouldn't be displayed diff --git a/tests/classes/implicit_instantiation_001.phpt b/tests/classes/implicit_instantiation_001.phpt deleted file mode 100644 index 495a8a1e35..0000000000 --- a/tests/classes/implicit_instantiation_001.phpt +++ /dev/null @@ -1,156 +0,0 @@ ---TEST-- -Implicit object instantiation when accessing properties of non-object. ---FILE-- -<?php -class C { - // These values get implicitly converted to objects - public $boolFalse = false; - public $emptyString = ''; - public $null = null; - - // These values do not get implicitly converted to objects - public $boolTrue = true; - public $nonEmptyString = 'hello'; - public $intZero = 0; -} - -$c = new C; -foreach($c as $name => $value) { - echo "\n\n---( \$c->$name )---"; - echo "\n --> Attempting implicit conversion to object using increment...\n"; - $c->$name->prop++; - $c->$name = $value; // reset value in case implicit conversion was successful - - echo "\n --> Attempting implicit conversion to object using assignment...\n"; - $c->$name->prop = "Implicit instantiation!"; - $c->$name = $value; // reset value in case implicit conversion was successful - - echo "\n --> Attempting implicit conversion to object using combined assignment...\n"; - $c->$name->prop .= " Implicit instantiation!"; -} - -echo "\n\n\n --> Resulting object:"; -var_dump($c); - -?> ---EXPECTF-- ----( $c->boolFalse )--- - --> Attempting implicit conversion to object using increment... - -Warning: Creating default object from empty value in %s on line 18 - -Notice: Undefined property: stdClass::$prop in %s on line 18 - - --> Attempting implicit conversion to object using assignment... - -Warning: Creating default object from empty value in %s on line 22 - - --> Attempting implicit conversion to object using combined assignment... - -Warning: Creating default object from empty value in %s on line 26 - -Notice: Undefined property: stdClass::$prop in %s on line 26 - - ----( $c->emptyString )--- - --> Attempting implicit conversion to object using increment... - -Warning: Creating default object from empty value in %s on line 18 - -Notice: Undefined property: stdClass::$prop in %s on line 18 - - --> Attempting implicit conversion to object using assignment... - -Warning: Creating default object from empty value in %s on line 22 - - --> Attempting implicit conversion to object using combined assignment... - -Warning: Creating default object from empty value in %s on line 26 - -Notice: Undefined property: stdClass::$prop in %s on line 26 - - ----( $c->null )--- - --> Attempting implicit conversion to object using increment... - -Warning: Creating default object from empty value in %s on line 18 - -Notice: Undefined property: stdClass::$prop in %s on line 18 - - --> Attempting implicit conversion to object using assignment... - -Warning: Creating default object from empty value in %s on line 22 - - --> Attempting implicit conversion to object using combined assignment... - -Warning: Creating default object from empty value in %s on line 26 - -Notice: Undefined property: stdClass::$prop in %s on line 26 - - ----( $c->boolTrue )--- - --> Attempting implicit conversion to object using increment... - -Warning: Attempt to %s property 'prop' of non-object in %s on line 18 - - --> Attempting implicit conversion to object using assignment... - -Warning: Attempt to assign property 'prop' of non-object in %s on line 22 - - --> Attempting implicit conversion to object using combined assignment... - -Warning: Attempt to assign property 'prop' of non-object in %s on line 26 - - ----( $c->nonEmptyString )--- - --> Attempting implicit conversion to object using increment... - -Warning: Attempt to %s property 'prop' of non-object in %s on line 18 - - --> Attempting implicit conversion to object using assignment... - -Warning: Attempt to assign property 'prop' of non-object in %s on line 22 - - --> Attempting implicit conversion to object using combined assignment... - -Warning: Attempt to assign property 'prop' of non-object in %s on line 26 - - ----( $c->intZero )--- - --> Attempting implicit conversion to object using increment... - -Warning: Attempt to %s property 'prop' of non-object in %s on line 18 - - --> Attempting implicit conversion to object using assignment... - -Warning: Attempt to assign property 'prop' of non-object in %s on line 22 - - --> Attempting implicit conversion to object using combined assignment... - -Warning: Attempt to assign property 'prop' of non-object in %s on line 26 - - - - --> Resulting object:object(C)#%d (6) { - ["boolFalse"]=> - object(stdClass)#%d (1) { - ["prop"]=> - string(24) " Implicit instantiation!" - } - ["emptyString"]=> - object(stdClass)#%d (1) { - ["prop"]=> - string(24) " Implicit instantiation!" - } - ["null"]=> - object(stdClass)#%d (1) { - ["prop"]=> - string(24) " Implicit instantiation!" - } - ["boolTrue"]=> - bool(true) - ["nonEmptyString"]=> - string(5) "hello" - ["intZero"]=> - int(0) -} diff --git a/tests/classes/incdec_property_001.phpt b/tests/classes/incdec_property_001.phpt index 8517a9fc4d..664c474097 100644 --- a/tests/classes/incdec_property_001.phpt +++ b/tests/classes/incdec_property_001.phpt @@ -4,19 +4,19 @@ ZE2 post increment/decrement property of overloaded object <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/incdec_property_002.phpt b/tests/classes/incdec_property_002.phpt index 930a58dc07..5e853c63e9 100644 --- a/tests/classes/incdec_property_002.phpt +++ b/tests/classes/incdec_property_002.phpt @@ -4,19 +4,19 @@ ZE2 post increment/decrement property of overloaded object with assignment <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/incdec_property_003.phpt b/tests/classes/incdec_property_003.phpt index edf3c00963..f2a696f7ea 100644 --- a/tests/classes/incdec_property_003.phpt +++ b/tests/classes/incdec_property_003.phpt @@ -4,19 +4,19 @@ ZE2 pre increment/decrement property of overloaded object <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/incdec_property_004.phpt b/tests/classes/incdec_property_004.phpt index 2267d568af..7a686bdf59 100644 --- a/tests/classes/incdec_property_004.phpt +++ b/tests/classes/incdec_property_004.phpt @@ -4,19 +4,19 @@ ZE2 pre increment/decrement property of overloaded object with assignment <?php class Test { - private $real_a = 2; + private $real_a = 2; - function __set($property, $value) { - if ($property == "a") { - $this->real_a = $value; - } - } + function __set($property, $value) { + if ($property == "a") { + $this->real_a = $value; + } + } - function __get($property) { - if ($property == "a") { - return $this->real_a; - } - } + function __get($property) { + if ($property == "a") { + return $this->real_a; + } + } } $obj = new Test; diff --git a/tests/classes/inheritance.phpt b/tests/classes/inheritance.phpt index 3f7e38b9ef..44b3cbc5bf 100644 --- a/tests/classes/inheritance.phpt +++ b/tests/classes/inheritance.phpt @@ -9,7 +9,7 @@ class foo { public $a; public $b; function display() { - echo "This is class foo\n"; + echo "This is class foo\n"; echo "a = ".$this->a."\n"; echo "b = ".$this->b."\n"; } diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt deleted file mode 100644 index f88c0996bd..0000000000 --- a/tests/classes/inheritance_002.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -ZE2 Constructor precedence ---FILE-- -<?php -class Base_php4 { - function Base_php4() { - var_dump('Base constructor'); - } -} - -class Child_php4 extends Base_php4 { - function Child_php4() { - var_dump('Child constructor'); - parent::Base_php4(); - } -} - -class Base_php5 { - function __construct() { - var_dump('Base constructor'); - } - } - -class Child_php5 extends Base_php5 { - function __construct() { - var_dump('Child constructor'); - parent::__construct(); - } - } - -class Child_mx1 extends Base_php4 { - function __construct() { - var_dump('Child constructor'); - parent::Base_php4(); - } -} - -class Child_mx2 extends Base_php5 { - function Child_mx2() { - var_dump('Child constructor'); - parent::__construct(); - } -} - -echo "### PHP 4 style\n"; -$c4= new Child_php4(); - -echo "### PHP 5 style\n"; -$c5= new Child_php5(); - -echo "### Mixed style 1\n"; -$cm= new Child_mx1(); - -echo "### Mixed style 2\n"; -$cm= new Child_mx2(); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base_php4 has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_php4 has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_mx2 has a deprecated constructor in %s on line %d -### PHP 4 style -string(17) "Child constructor" -string(16) "Base constructor" -### PHP 5 style -string(17) "Child constructor" -string(16) "Base constructor" -### Mixed style 1 -string(17) "Child constructor" -string(16) "Base constructor" -### Mixed style 2 -string(17) "Child constructor" -string(16) "Base constructor" diff --git a/tests/classes/inheritance_003.phpt b/tests/classes/inheritance_003.phpt index bcbead1be7..224c8299aa 100644 --- a/tests/classes/inheritance_003.phpt +++ b/tests/classes/inheritance_003.phpt @@ -5,16 +5,14 @@ ZE2 method inheritance without interfaces class A { - function f($x) {} + function f($x) {} } class B extends A { - function f() {} + function f() {} } ?> -===DONE=== --EXPECTF-- -Warning: Declaration of B::f() should be compatible with A::f($x) in %sinheritance_003.php on line %d -===DONE=== +Fatal error: Declaration of B::f() must be compatible with A::f($x) in %sinheritance_003.php on line %d diff --git a/tests/classes/inheritance_004.phpt b/tests/classes/inheritance_004.phpt index 7eb57b2770..5ea656febb 100644 --- a/tests/classes/inheritance_004.phpt +++ b/tests/classes/inheritance_004.phpt @@ -5,16 +5,14 @@ ZE2 method inheritance without interfaces class A { - function f() {} +function f() {} } class B extends A { - function f($x) {} + function f($x) {} } ?> -===DONE=== --EXPECTF-- -Warning: Declaration of B::f($x) should be compatible with A::f() in %sinheritance_004.php on line %d -===DONE=== +Fatal error: Declaration of B::f($x) must be compatible with A::f() in %sinheritance_004.php on line %d diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt deleted file mode 100644 index 8c5167f4bf..0000000000 --- a/tests/classes/inheritance_005.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -Check for inherited old-style constructor. ---FILE-- -<?php - class A - { - function A() - { - echo "In " . __METHOD__ . "\n"; - } - } - - class B extends A - { - } - - class C extends B - { - } - - - echo "About to construct new B: \n"; - $b = new B; - - 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 "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-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -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 3d5c275011..6009c35ffc 100644 --- a/tests/classes/inheritance_006.phpt +++ b/tests/classes/inheritance_006.phpt @@ -3,11 +3,11 @@ Private property inheritance check --FILE-- <?php Class A { - private $c; + private $c; } Class B extends A { - private $c; + private $c; } Class C extends B { diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt deleted file mode 100644 index c87fbde344..0000000000 --- a/tests/classes/inheritance_007.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Ensure inherited old-style constructor doesn't block other methods ---FILE-- -<?php -class A { - public function B () { echo "In " . __METHOD__ . "\n"; } - public function A () { echo "In " . __METHOD__ . "\n"; } -} -class B extends A { } - -$rc = new ReflectionClass('B'); -var_dump($rc->getMethods()); - - -$b = new B(); -$b->a(); -$b->b(); - -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -array(2) { - [0]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(1) "B" - ["class"]=> - string(1) "A" - } - [1]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(1) "A" - ["class"]=> - string(1) "A" - } -} -In A::A -In A::A -In A::B diff --git a/tests/classes/interface_and_extends.phpt b/tests/classes/interface_and_extends.phpt index 8bb1ec05f1..080ba24da9 100644 --- a/tests/classes/interface_and_extends.phpt +++ b/tests/classes/interface_and_extends.phpt @@ -5,14 +5,14 @@ ZE2 a class cannot extend an interface interface Test { - function show(); + function show(); } class Tester extends Test { - function show() { - echo __METHOD__ . "\n"; - } + function show() { + echo __METHOD__ . "\n"; + } } $o = new Tester; diff --git a/tests/classes/interface_constant_inheritance_001.phpt b/tests/classes/interface_constant_inheritance_001.phpt index 9f5e76d297..a925097cdb 100644 --- a/tests/classes/interface_constant_inheritance_001.phpt +++ b/tests/classes/interface_constant_inheritance_001.phpt @@ -3,11 +3,11 @@ Ensure an interface may not shadow an inherited constant. --FILE-- <?php interface I1 { - const FOO = 10; + const FOO = 10; } interface I2 extends I1 { - const FOO = 10; + const FOO = 10; } echo "Done\n"; diff --git a/tests/classes/interface_constant_inheritance_002.phpt b/tests/classes/interface_constant_inheritance_002.phpt index 681de11cbf..8840f7caf4 100644 --- a/tests/classes/interface_constant_inheritance_002.phpt +++ b/tests/classes/interface_constant_inheritance_002.phpt @@ -3,11 +3,11 @@ Ensure a class may not shadow a constant inherited from an interface. --FILE-- <?php interface I { - const FOO = 10; + const FOO = 10; } class C implements I { - const FOO = 10; + const FOO = 10; } echo "Done\n"; diff --git a/tests/classes/interface_constant_inheritance_003.phpt b/tests/classes/interface_constant_inheritance_003.phpt index b4902f7306..de867f5dfc 100644 --- a/tests/classes/interface_constant_inheritance_003.phpt +++ b/tests/classes/interface_constant_inheritance_003.phpt @@ -3,11 +3,11 @@ Ensure a class may not inherit two constants with the same name from two separat --FILE-- <?php interface I1 { - const FOO = 10; + const FOO = 10; } interface I2 { - const FOO = 10; + const FOO = 10; } class C implements I1,I2 { diff --git a/tests/classes/interface_constant_inheritance_004.phpt b/tests/classes/interface_constant_inheritance_004.phpt index aca9865eb1..359ce58b38 100644 --- a/tests/classes/interface_constant_inheritance_004.phpt +++ b/tests/classes/interface_constant_inheritance_004.phpt @@ -3,7 +3,7 @@ Ensure a class may implement two interfaces which include the same constant (due --FILE-- <?php interface IA { - const FOO = 10; + const FOO = 10; } interface IB extends IA { diff --git a/tests/classes/interface_constant_inheritance_005.phpt b/tests/classes/interface_constant_inheritance_005.phpt index 1abb85751e..3d728ae46a 100644 --- a/tests/classes/interface_constant_inheritance_005.phpt +++ b/tests/classes/interface_constant_inheritance_005.phpt @@ -3,7 +3,7 @@ Ensure a interface can have public constants --FILE-- <?php interface IA { - public const FOO = 10; + public const FOO = 10; } echo "Done\n"; diff --git a/tests/classes/interface_constant_inheritance_006.phpt b/tests/classes/interface_constant_inheritance_006.phpt index 7e303bb152..82ffa7c314 100644 --- a/tests/classes/interface_constant_inheritance_006.phpt +++ b/tests/classes/interface_constant_inheritance_006.phpt @@ -3,7 +3,7 @@ Ensure a interface can not have protected constants --FILE-- <?php interface A { - protected const FOO = 10; + protected const FOO = 10; } --EXPECTF-- Fatal error: Access type for interface constant A::FOO must be public in %s on line 3 diff --git a/tests/classes/interface_constant_inheritance_007.phpt b/tests/classes/interface_constant_inheritance_007.phpt index 766f89b95d..e072e65e63 100644 --- a/tests/classes/interface_constant_inheritance_007.phpt +++ b/tests/classes/interface_constant_inheritance_007.phpt @@ -3,7 +3,7 @@ Ensure a interface can not have private constants --FILE-- <?php interface A { - private const FOO = 10; + private const FOO = 10; } --EXPECTF-- Fatal error: Access type for interface constant A::FOO must be public in %s on line 3 diff --git a/tests/classes/interface_doubled.phpt b/tests/classes/interface_doubled.phpt index 8fbfcba7ff..4a176892db 100644 --- a/tests/classes/interface_doubled.phpt +++ b/tests/classes/interface_doubled.phpt @@ -4,42 +4,42 @@ ZE2 An interface extends base interfaces <?php interface if_a { - function f_a(); + function f_a(); } interface if_b { - function f_b(); + function f_b(); } interface if_c extends if_a, if_b { - function f_c(); + function f_c(); } interface if_d extends if_a, if_b { - function f_d(); + function f_d(); } interface if_e { - function f_d(); + function f_d(); } interface if_f extends /*if_e,*/ if_a, if_b, if_c, if_d /*, if_e*/ { } class base { - function test($class) { - echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n"); - } + function test($class) { + echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n"); + } } echo "class_a\n"; class class_a extends base implements if_a { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_a(); @@ -52,11 +52,11 @@ echo $t->test('if_e'); echo "class_b\n"; class class_b extends base implements if_a, if_b { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_b(); @@ -69,11 +69,11 @@ echo $t->test('if_e'); echo "class_c\n"; class class_c extends base implements if_c { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_c(); @@ -86,11 +86,11 @@ echo $t->test('if_e'); echo "class_d\n"; class class_d extends base implements if_d{ - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_d(); @@ -103,11 +103,11 @@ echo $t->test('if_e'); echo "class_e\n"; class class_e extends base implements if_a, if_b, if_c, if_d { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_e(); @@ -120,11 +120,11 @@ echo $t->test('if_e'); echo "class_f\n"; class class_f extends base implements if_e { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_f(); @@ -137,11 +137,11 @@ echo $t->test('if_e'); echo "class_g\n"; class class_g extends base implements if_f { - function f_a() {} - function f_b() {} - function f_c() {} - function f_d() {} - function f_e() {} + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} } $t = new class_g(); @@ -152,7 +152,6 @@ echo $t->test('if_d'); echo $t->test('if_e'); ?> -===DONE=== --EXPECT-- class_a is_a(class_a, if_a) yes @@ -196,4 +195,3 @@ is_a(class_g, if_b) yes is_a(class_g, if_c) yes is_a(class_g, if_d) yes is_a(class_g, if_e) no -===DONE=== diff --git a/tests/classes/interface_implemented.phpt b/tests/classes/interface_implemented.phpt index e224c5bd23..52bb7de02d 100644 --- a/tests/classes/interface_implemented.phpt +++ b/tests/classes/interface_implemented.phpt @@ -4,40 +4,40 @@ ZE2 An interface is inherited <?php interface if_a { - function f_a(); + function f_a(); } interface if_b extends if_a { - function f_b(); + function f_b(); } class base { - function _is_a($sub) { - echo 'is_a('.get_class($this).', '.$sub.') = '.(($this instanceof $sub) ? 'yes' : 'no')."\n"; - } - function test() { - echo $this->_is_a('base'); - echo $this->_is_a('derived_a'); - echo $this->_is_a('derived_b'); - echo $this->_is_a('derived_c'); - echo $this->_is_a('derived_d'); - echo $this->_is_a('if_a'); - echo $this->_is_a('if_b'); - echo "\n"; - } + function _is_a($sub) { + echo 'is_a('.get_class($this).', '.$sub.') = '.(($this instanceof $sub) ? 'yes' : 'no')."\n"; + } + function test() { + echo $this->_is_a('base'); + echo $this->_is_a('derived_a'); + echo $this->_is_a('derived_b'); + echo $this->_is_a('derived_c'); + echo $this->_is_a('derived_d'); + echo $this->_is_a('if_a'); + echo $this->_is_a('if_b'); + echo "\n"; + } } class derived_a extends base implements if_a { - function f_a() {} + function f_a() {} } class derived_b extends base implements if_a, if_b { - function f_a() {} - function f_b() {} + function f_a() {} + function f_b() {} } class derived_c extends derived_a implements if_b { - function f_b() {} + function f_b() {} } class derived_d extends derived_c { diff --git a/tests/classes/interface_instantiate.phpt b/tests/classes/interface_instantiate.phpt index 04b0e29701..2fab5fd3da 100644 --- a/tests/classes/interface_instantiate.phpt +++ b/tests/classes/interface_instantiate.phpt @@ -4,7 +4,7 @@ ZE2 An interface cannot be instantiated <?php interface if_a { - function f_a(); + function f_a(); } $t = new if_a(); diff --git a/tests/classes/interface_member.phpt b/tests/classes/interface_member.phpt index 3b50b30ffe..d44b497ca4 100644 --- a/tests/classes/interface_member.phpt +++ b/tests/classes/interface_member.phpt @@ -4,7 +4,7 @@ ZE2 An interface cannot have properties <?php interface if_a { - public $member; + public $member; } ?> --EXPECTF-- diff --git a/tests/classes/interface_method.phpt b/tests/classes/interface_method.phpt index 491b4c21d6..04e2953676 100644 --- a/tests/classes/interface_method.phpt +++ b/tests/classes/interface_method.phpt @@ -4,7 +4,7 @@ ZE2 An interface method must be abstract <?php interface if_a { - function err() {} + function err() {} } ?> diff --git a/tests/classes/interface_method_final.phpt b/tests/classes/interface_method_final.phpt index e936b5a03a..42783c6f12 100644 --- a/tests/classes/interface_method_final.phpt +++ b/tests/classes/interface_method_final.phpt @@ -4,7 +4,7 @@ ZE2 An interface method cannot be final <?php class if_a { - abstract final function err(); + abstract final function err(); } ?> diff --git a/tests/classes/interface_method_private.phpt b/tests/classes/interface_method_private.phpt index 11f8bf648f..4661a86375 100644 --- a/tests/classes/interface_method_private.phpt +++ b/tests/classes/interface_method_private.phpt @@ -4,7 +4,7 @@ ZE2 An interface method cannot be private <?php interface if_a { - abstract private function err(); + abstract private function err(); } ?> diff --git a/tests/classes/interface_must_be_implemented.phpt b/tests/classes/interface_must_be_implemented.phpt index 7dc39436e9..300ace23e3 100644 --- a/tests/classes/interface_must_be_implemented.phpt +++ b/tests/classes/interface_must_be_implemented.phpt @@ -4,7 +4,7 @@ ZE2 An interface must be implemented <?php interface if_a { - function f_a(); + function f_a(); } class derived_a implements if_a { diff --git a/tests/classes/interface_optional_arg.phpt b/tests/classes/interface_optional_arg.phpt index 6fc97f55fb..ab377e1c76 100644 --- a/tests/classes/interface_optional_arg.phpt +++ b/tests/classes/interface_optional_arg.phpt @@ -6,14 +6,14 @@ ZE2 An interface method allows additional default arguments error_reporting(4095); interface test { - public function bar(); + public function bar(); } class foo implements test { - public function bar($foo = NULL) { - echo "foo\n"; - } + public function bar($foo = NULL) { + echo "foo\n"; + } } $foo = new foo; diff --git a/tests/classes/interface_optional_arg_002.phpt b/tests/classes/interface_optional_arg_002.phpt index 67e6785883..190b47aa4f 100644 --- a/tests/classes/interface_optional_arg_002.phpt +++ b/tests/classes/interface_optional_arg_002.phpt @@ -4,14 +4,14 @@ default argument value in interface implementation <?php interface test { - public function bar(); + public function bar(); } class foo implements test { - public function bar($arg = 2) { - var_dump($arg); - } + public function bar($arg = 2) { + var_dump($arg); + } } $foo = new foo; diff --git a/tests/classes/interface_optional_arg_003.phpt b/tests/classes/interface_optional_arg_003.phpt index cf583fe204..7a972c728b 100644 --- a/tests/classes/interface_optional_arg_003.phpt +++ b/tests/classes/interface_optional_arg_003.phpt @@ -6,7 +6,7 @@ include 'interface_optional_arg_003.inc'; class C implements I { function f($a = 2) { - var_dump($a); + var_dump($a); } } diff --git a/tests/classes/interfaces_001.phpt b/tests/classes/interfaces_001.phpt index 97b48aa03d..3b1aabb6a7 100644 --- a/tests/classes/interfaces_001.phpt +++ b/tests/classes/interfaces_001.phpt @@ -4,15 +4,15 @@ ZE2 interfaces <?php interface ThrowableInterface { - public function getMessage(); + public function getMessage(); } class Exception_foo implements ThrowableInterface { - public $foo = "foo"; + public $foo = "foo"; - public function getMessage() { - return $this->foo; - } + public function getMessage() { + return $this->foo; + } } $foo = new Exception_foo; diff --git a/tests/classes/interfaces_002.phpt b/tests/classes/interfaces_002.phpt index 6cc899bf1d..14ac1f0ffc 100644 --- a/tests/classes/interfaces_002.phpt +++ b/tests/classes/interfaces_002.phpt @@ -4,16 +4,16 @@ ZE2 interface with an unimplemented method <?php interface ThrowableInterface { - public function getMessage(); - public function getErrno(); + public function getMessage(); + public function getErrno(); } class Exception_foo implements ThrowableInterface { - public $foo = "foo"; + public $foo = "foo"; - public function getMessage() { - return $this->foo; - } + public function getMessage() { + return $this->foo; + } } // this should die -- Exception class must be abstract... diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt index 97b5f7dde5..349dc66bd8 100644 --- a/tests/classes/interfaces_003.phpt +++ b/tests/classes/interfaces_003.phpt @@ -7,14 +7,14 @@ class MyObject {} interface MyInterface { - public function __construct(MyObject $o); + public function __construct(MyObject $o); } class MyTestClass implements MyInterface { - public function __construct(MyObject $o) - { - } + public function __construct(MyObject $o) + { + } } $obj = new MyTestClass; diff --git a/tests/classes/iterators_001.phpt b/tests/classes/iterators_001.phpt index e4060e375f..17588bc8cd 100644 --- a/tests/classes/iterators_001.phpt +++ b/tests/classes/iterators_001.phpt @@ -4,78 +4,78 @@ ZE2 iterators and foreach <?php class c_iter implements Iterator { - private $obj; - private $num = 0; + private $obj; + private $num = 0; - function __construct($obj) { - echo __METHOD__ . "\n"; - $this->num = 0; - $this->obj = $obj; - } - function rewind() { - } - function valid() { - $more = $this->num < $this->obj->max; - echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; - return $more; - } - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function key() { - echo __METHOD__ . "\n"; - switch($this->num) { - case 0: return "1st"; - case 1: return "2nd"; - case 2: return "3rd"; - default: return "???"; - } - } + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->num = 0; + $this->obj = $obj; + } + function rewind() { + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } } class c implements IteratorAggregate { - public $max = 3; + public $max = 3; - function getIterator() { - echo __METHOD__ . "\n"; - return new c_iter($this); - } + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } } echo "===Array===\n"; $a = array(0,1,2); foreach($a as $v) { - echo "array:$v\n"; + echo "array:$v\n"; } echo "===Manual===\n"; $t = new c(); for ($iter = $t->getIterator(); $iter->valid(); $iter->next()) { - echo $iter->current() . "\n"; + echo $iter->current() . "\n"; } echo "===foreach/std===\n"; foreach($t as $v) { - echo "object:$v\n"; + echo "object:$v\n"; } echo "===foreach/rec===\n"; foreach($t as $v) { - foreach($t as $w) { - echo "double:$v:$w\n"; - } + foreach($t as $w) { + echo "double:$v:$w\n"; + } } echo "===foreach/key===\n"; foreach($t as $i => $v) { - echo "object:$i=>$v\n"; + echo "object:$i=>$v\n"; } print "Done\n"; diff --git a/tests/classes/iterators_002.phpt b/tests/classes/iterators_002.phpt index 5e1ceb6208..4035f7c4f4 100644 --- a/tests/classes/iterators_002.phpt +++ b/tests/classes/iterators_002.phpt @@ -4,64 +4,64 @@ ZE2 iterators and break <?php class c_iter implements Iterator { - private $obj; - private $num = 0; + private $obj; + private $num = 0; - function __construct($obj) { - echo __METHOD__ . "\n"; - $this->obj = $obj; - } - function rewind() { - echo __METHOD__ . "\n"; - $this->num = 0; - } - function valid() { - $more = $this->num < $this->obj->max; - echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; - return $more; - } - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function key() { - echo __METHOD__ . "\n"; - switch($this->num) { - case 0: return "1st"; - case 1: return "2nd"; - case 2: return "3rd"; - default: return "???"; - } - } - function __destruct() { - echo __METHOD__ . "\n"; - } + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + $this->num = 0; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } + function __destruct() { + echo __METHOD__ . "\n"; + } } class c implements IteratorAggregate { - public $max = 3; + public $max = 3; - function getIterator() { - echo __METHOD__ . "\n"; - return new c_iter($this); - } - function __destruct() { - echo __METHOD__ . "\n"; - } + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } + function __destruct() { + echo __METHOD__ . "\n"; + } } $t = new c(); foreach($t as $k => $v) { - foreach($t as $w) { - echo "double:$v:$w\n"; - break; - } + foreach($t as $w) { + echo "double:$v:$w\n"; + break; + } } unset($t); diff --git a/tests/classes/iterators_003.phpt b/tests/classes/iterators_003.phpt index f417478d49..5557402d8d 100644 --- a/tests/classes/iterators_003.phpt +++ b/tests/classes/iterators_003.phpt @@ -4,66 +4,66 @@ ZE2 iterators and break <?php class c_iter implements Iterator { - private $obj; - private $num = 0; + private $obj; + private $num = 0; - function __construct($obj) { - echo __METHOD__ . "\n"; - $this->obj = $obj; - } - function rewind() { - echo __METHOD__ . "\n"; - } - function valid() { - $more = $this->num < $this->obj->max; - echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; - return $more; - } - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function key() { - return $this->num; - } + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + return $this->num; + } } class c implements IteratorAggregate { - public $max = 4; + public $max = 4; - function getIterator() { - echo __METHOD__ . "\n"; - return new c_iter($this); - } + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } } $t = new c(); foreach($t as $v) { - if ($v == 0) { - echo "continue outer\n"; - continue; - } - foreach($t as $w) { - if ($w == 1) { - echo "continue inner\n"; - continue; - } - if ($w == 2) { - echo "break inner\n"; - break; - } - echo "double:$v:$w\n"; - } - if ($v == 2) { - echo "break outer\n"; - break; - } + if ($v == 0) { + echo "continue outer\n"; + continue; + } + foreach($t as $w) { + if ($w == 1) { + echo "continue inner\n"; + continue; + } + if ($w == 2) { + echo "break inner\n"; + break; + } + echo "double:$v:$w\n"; + } + if ($v == 2) { + echo "break outer\n"; + break; + } } print "Done\n"; diff --git a/tests/classes/iterators_004.phpt b/tests/classes/iterators_004.phpt index dc5a07a603..77d036a075 100644 --- a/tests/classes/iterators_004.phpt +++ b/tests/classes/iterators_004.phpt @@ -10,43 +10,43 @@ class c1 {} $obj = new c1(); foreach($obj as $w) { - echo "object:$w\n"; + echo "object:$w\n"; } echo "2nd try\n"; class c2 { - public $max = 3; - public $num = 0; - - function current() { - echo __METHOD__ . "\n"; - return $this->num; - } - function next() { - echo __METHOD__ . "\n"; - $this->num++; - } - function valid() { - echo __METHOD__ . "\n"; - return $this->num < $this->max; - } - function key() { - echo __METHOD__ . "\n"; - switch($this->num) { - case 0: return "1st"; - case 1: return "2nd"; - case 2: return "3rd"; - default: return "???"; - } - } + public $max = 3; + public $num = 0; + + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function valid() { + echo __METHOD__ . "\n"; + return $this->num < $this->max; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } } $obj = new c2(); foreach($obj as $v => $w) { - echo "object:$v=>$w\n"; + echo "object:$v=>$w\n"; } print "Done\n"; diff --git a/tests/classes/iterators_006.phpt b/tests/classes/iterators_006.phpt index 7baa077f2b..8bc8516723 100644 --- a/tests/classes/iterators_006.phpt +++ b/tests/classes/iterators_006.phpt @@ -5,47 +5,47 @@ ZE2 iterators and array wrapping class ai implements Iterator { - private $array; + private $array; - function __construct() { - $this->array = array('foo', 'bar', 'baz'); - } + function __construct() { + $this->array = array('foo', 'bar', 'baz'); + } - function rewind() { - reset($this->array); - $this->next(); - } + function rewind() { + reset($this->array); + $this->next(); + } - function valid() { - return $this->key !== NULL; - } + function valid() { + return $this->key !== NULL; + } - function key() { - return $this->key; - } + function key() { + return $this->key; + } - function current() { - return $this->current; - } + function current() { + return $this->current; + } - function next() { + function next() { $this->key = key($this->array); $this->current = current($this->array); next($this->array); - } + } } class a implements IteratorAggregate { - public function getIterator() { - return new ai(); - } + public function getIterator() { + return new ai(); + } } $array = new a(); foreach ($array as $property => $value) { - print "$property: $value\n"; + print "$property: $value\n"; } #$array = $array->getIterator(); @@ -58,17 +58,16 @@ echo "===2nd===\n"; $array = new ai(); foreach ($array as $property => $value) { - print "$property: $value\n"; + print "$property: $value\n"; } echo "===3rd===\n"; foreach ($array as $property => $value) { - print "$property: $value\n"; + print "$property: $value\n"; } ?> -===DONE=== --EXPECT-- 0: foo 1: bar @@ -81,4 +80,3 @@ foreach ($array as $property => $value) { 0: foo 1: bar 2: baz -===DONE=== diff --git a/tests/classes/iterators_007.phpt b/tests/classes/iterators_007.phpt index 87b7e5318b..db1c868e0d 100644 --- a/tests/classes/iterators_007.phpt +++ b/tests/classes/iterators_007.phpt @@ -4,35 +4,34 @@ ZE2 iterators and exceptions <?php class Test implements Iterator { - public $arr = array(1, 2, 3); - public $x = 0; + public $arr = array(1, 2, 3); + public $x = 0; - public function rewind() { if ($this->x == 0) throw new Exception(__METHOD__); reset($this->arr); } - public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); } - public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); } - public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); } - public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); } + public function rewind() { if ($this->x == 0) throw new Exception(__METHOD__); reset($this->arr); } + public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); } + public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); } + public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); } + public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); } } $t = new Test(); while($t->x < 5) { - try - { - foreach($t as $k => $v) - { - echo "Current\n"; - } - } - catch(Exception $e) - { - echo "Caught in " . $e->getMessage() . "()\n"; - } - $t->x++; + try + { + foreach($t as $k => $v) + { + echo "Current\n"; + } + } + catch(Exception $e) + { + echo "Caught in " . $e->getMessage() . "()\n"; + } + $t->x++; } ?> -===DONE=== --EXPECT-- Caught in Test::rewind() Caught in Test::current() @@ -40,4 +39,3 @@ Caught in Test::key() Current Caught in Test::next() Caught in Test::valid() -===DONE=== diff --git a/tests/classes/method_override_optional_arg_001.phpt b/tests/classes/method_override_optional_arg_001.phpt index 897a2c2b93..3d9b0f5ff9 100644 --- a/tests/classes/method_override_optional_arg_001.phpt +++ b/tests/classes/method_override_optional_arg_001.phpt @@ -4,20 +4,20 @@ Method override allows optional default argument <?php class A { - function foo($arg1 = 1) { - } + function foo($arg1 = 1) { + } } class B extends A { - function foo($arg1 = 2, $arg2 = 3) { - var_dump($arg1); - var_dump($arg2); - } + function foo($arg1 = 2, $arg2 = 3) { + var_dump($arg1); + var_dump($arg2); + } } class C extends A { - function foo() { - } + function foo() { + } } $b = new B(); @@ -26,6 +26,4 @@ $b->foo(1); ?> --EXPECTF-- -Warning: Declaration of C::foo() should be compatible with A::foo($arg1 = 1) in %s on line %d -int(1) -int(3) +Fatal error: Declaration of C::foo() must be compatible with A::foo($arg1 = 1) in %s on line %d diff --git a/tests/classes/method_override_optional_arg_002.phpt b/tests/classes/method_override_optional_arg_002.phpt index 254392718b..ee94469e51 100644 --- a/tests/classes/method_override_optional_arg_002.phpt +++ b/tests/classes/method_override_optional_arg_002.phpt @@ -4,13 +4,13 @@ Omitting optional arg in method inherited from abstract class <?php abstract class A { - function foo($arg = 1) {} + function foo($arg = 1) {} } class B extends A { - function foo() { - echo "foo\n"; - } + function foo() { + echo "foo\n"; + } } $b = new B(); @@ -18,5 +18,4 @@ $b->foo(); ?> --EXPECTF-- -Warning: Declaration of B::foo() should be compatible with A::foo($arg = 1) in %s on line %d -foo +Fatal error: Declaration of B::foo() must be compatible with A::foo($arg = 1) in %s on line %d diff --git a/tests/classes/object_reference_001.phpt b/tests/classes/object_reference_001.phpt index 9842ac00f5..a98802d07a 100644 --- a/tests/classes/object_reference_001.phpt +++ b/tests/classes/object_reference_001.phpt @@ -4,11 +4,11 @@ ZE2 object references <?php class Foo { - public $name; + public $name; - function __construct() { - $this->name = "I'm Foo!\n"; - } + function __construct() { + $this->name = "I'm Foo!\n"; + } } $foo = new Foo; diff --git a/tests/classes/private_001.phpt b/tests/classes/private_001.phpt index 79b94c4f9a..34e716e334 100644 --- a/tests/classes/private_001.phpt +++ b/tests/classes/private_001.phpt @@ -4,13 +4,13 @@ ZE2 A private method can only be called inside the class <?php class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } pass::do_show(); diff --git a/tests/classes/private_002.phpt b/tests/classes/private_002.phpt index 892580f36d..7f85324503 100644 --- a/tests/classes/private_002.phpt +++ b/tests/classes/private_002.phpt @@ -4,22 +4,22 @@ ZE2 A private method cannot be called in another class <?php class pass { - private static function show() { - echo "Call pass::show()\n"; - } + private static function show() { + echo "Call pass::show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } pass::do_show(); class fail { - public static function show() { - echo "Call fail::show()\n"; - pass::show(); - } + public static function show() { + echo "Call fail::show()\n"; + pass::show(); + } } fail::show(); diff --git a/tests/classes/private_003.phpt b/tests/classes/private_003.phpt index 0843c5ef63..c142ad5cc7 100644 --- a/tests/classes/private_003.phpt +++ b/tests/classes/private_003.phpt @@ -4,23 +4,23 @@ ZE2 A private method cannot be called in a derived class <?php ini_set("error_reporting",2039); class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - protected static function good() { - pass::show(); - } + protected static function good() { + pass::show(); + } } class fail extends pass { - static function ok() { - pass::good(); - } + static function ok() { + pass::good(); + } - static function not_ok() { - pass::show(); - } + static function not_ok() { + pass::show(); + } } fail::ok(); diff --git a/tests/classes/private_003b.phpt b/tests/classes/private_003b.phpt index fe2f464ee8..9c5e5cbb9a 100644 --- a/tests/classes/private_003b.phpt +++ b/tests/classes/private_003b.phpt @@ -4,23 +4,23 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } - protected function good() { - $this->show(); - } + protected function good() { + $this->show(); + } } class fail extends pass { - public function ok() { - $this->good(); - } + public function ok() { + $this->good(); + } - public function not_ok() { - $this->show(); - } + public function not_ok() { + $this->show(); + } } $t = new fail(); diff --git a/tests/classes/private_004.phpt b/tests/classes/private_004.phpt index 13a4e90535..bfecff55b9 100644 --- a/tests/classes/private_004.phpt +++ b/tests/classes/private_004.phpt @@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } class fail extends pass { - static function do_show() { - fail::show(); - } + static function do_show() { + fail::show(); + } } pass::do_show(); diff --git a/tests/classes/private_004b.phpt b/tests/classes/private_004b.phpt index db139f65b7..302c617a5f 100644 --- a/tests/classes/private_004b.phpt +++ b/tests/classes/private_004b.phpt @@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } - public function do_show() { - $this->show(); - } + public function do_show() { + $this->show(); + } } class fail extends pass { - function do_show() { - $this->show(); - } + function do_show() { + $this->show(); + } } $t = new pass(); diff --git a/tests/classes/private_005.phpt b/tests/classes/private_005.phpt index 0c6d978f79..1fb0e3e9fa 100644 --- a/tests/classes/private_005.phpt +++ b/tests/classes/private_005.phpt @@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class <?php class pass { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } class fail extends pass { - static function do_show() { - pass::show(); - } + static function do_show() { + pass::show(); + } } pass::do_show(); diff --git a/tests/classes/private_006.phpt b/tests/classes/private_006.phpt index 895affac75..9f755abf8e 100644 --- a/tests/classes/private_006.phpt +++ b/tests/classes/private_006.phpt @@ -3,13 +3,13 @@ ZE2 A private method can be overwritten in a second derived class --FILE-- <?php class first { - private static function show() { - echo "Call show()\n"; - } + private static function show() { + echo "Call show()\n"; + } - public static function do_show() { - first::show(); - } + public static function do_show() { + first::show(); + } } first::do_show(); @@ -25,9 +25,9 @@ class third extends second { third::do_show(); class fail extends third { - static function show() { // cannot be redeclared - echo "Call show()\n"; - } + static function show() { // cannot be redeclared + echo "Call show()\n"; + } } echo "Done\n"; diff --git a/tests/classes/private_006b.phpt b/tests/classes/private_006b.phpt index 1c678601b6..cdb7f2166e 100644 --- a/tests/classes/private_006b.phpt +++ b/tests/classes/private_006b.phpt @@ -4,13 +4,13 @@ ZE2 A private method can be overwritten in a second derived class <?php class first { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } - public function do_show() { - $this->show(); - } + public function do_show() { + $this->show(); + } } $t1 = new first(); @@ -23,9 +23,9 @@ class second extends first { //$t2->do_show(); class third extends second { - private function show() { - echo "Call show()\n"; - } + private function show() { + echo "Call show()\n"; + } } $t3 = new third(); diff --git a/tests/classes/private_007.phpt b/tests/classes/private_007.phpt index abc2258bc2..84cdb137b8 100644 --- a/tests/classes/private_007.phpt +++ b/tests/classes/private_007.phpt @@ -4,17 +4,17 @@ ZE2 A derived class does not know about privates of ancestors <?php class Bar { - public static function pub() { - Bar::priv(); - } - private static function priv() { - echo "Bar::priv()\n"; - } + public static function pub() { + Bar::priv(); + } + private static function priv() { + echo "Bar::priv()\n"; + } } class Foo extends Bar { - public static function priv() { - echo "Foo::priv()\n"; - } + public static function priv() { + echo "Foo::priv()\n"; + } } Foo::pub(); diff --git a/tests/classes/private_007b.phpt b/tests/classes/private_007b.phpt index 3272d0c8a0..305048055f 100644 --- a/tests/classes/private_007b.phpt +++ b/tests/classes/private_007b.phpt @@ -4,17 +4,17 @@ ZE2 A derived class does not know about privates of ancestors <?php class Bar { - public function pub() { - $this->priv(); - } - private function priv() { - echo "Bar::priv()\n"; - } + public function pub() { + $this->priv(); + } + private function priv() { + echo "Bar::priv()\n"; + } } class Foo extends Bar { - public function priv() { - echo "Foo::priv()\n"; - } + public function priv() { + echo "Foo::priv()\n"; + } } $obj = new Foo(); diff --git a/tests/classes/private_members.phpt b/tests/classes/private_members.phpt index 4d8fd9eeb0..1b48722dbb 100644 --- a/tests/classes/private_members.phpt +++ b/tests/classes/private_members.phpt @@ -9,15 +9,15 @@ class base function __construct() { - echo __METHOD__ . "(begin)\n"; + echo __METHOD__ . "(begin)\n"; $this->member = 'base::member'; $this->test(); - echo __METHOD__ . "(end)\n"; + echo __METHOD__ . "(end)\n"; } function test() { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; print_r($this); } } @@ -28,18 +28,18 @@ class derived extends base function __construct() { - echo __METHOD__ . "(begin)\n"; - parent::__construct(); - parent::test(); - $this->test(); + echo __METHOD__ . "(begin)\n"; + parent::__construct(); + parent::test(); + $this->test(); $this->member = 'derived::member'; - echo __METHOD__ . "(end)\n"; + echo __METHOD__ . "(end)\n"; } function test() { - parent::test(); - echo __METHOD__ . "\n"; + parent::test(); + echo __METHOD__ . "\n"; print_r($this); } } diff --git a/tests/classes/private_members_serialization.phpt b/tests/classes/private_members_serialization.phpt index c196f7d8f9..1b04b6f59c 100644 --- a/tests/classes/private_members_serialization.phpt +++ b/tests/classes/private_members_serialization.phpt @@ -4,17 +4,17 @@ Verifies that it is possible to return private member names of parent classes in <?php class foo { - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; + private $private = 'private'; + protected $protected = 'protected'; + public $public = 'public'; } class bar extends foo { - public function __sleep() - { - return array("\0foo\0private", 'protected', 'public'); - } + public function __sleep() + { + return array("\0foo\0private", 'protected', 'public'); + } } var_dump(str_replace("\0", '\0', serialize(new bar()))); diff --git a/tests/classes/private_redeclare.phpt b/tests/classes/private_redeclare.phpt index b42cc7d7fe..cee59985c1 100644 --- a/tests/classes/private_redeclare.phpt +++ b/tests/classes/private_redeclare.phpt @@ -3,27 +3,27 @@ ZE2 A derived class does not know anything about inherited private methods --FILE-- <?php class base { - private function show() { - echo "base\n"; - } - function test() { - $this->show(); - } + private function show() { + echo "base\n"; + } + function test() { + $this->show(); + } } $t = new base(); $t->test(); class derived extends base { - function show() { - echo "derived\n"; - } - function test() { - echo "test\n"; - $this->show(); - parent::test(); - parent::show(); - } + function show() { + echo "derived\n"; + } + function test() { + echo "test\n"; + $this->show(); + parent::test(); + parent::show(); + } } $t = new derived(); diff --git a/tests/classes/property_recreate_private.phpt b/tests/classes/property_recreate_private.phpt index 6d25d71912..8dc3e18eb0 100644 --- a/tests/classes/property_recreate_private.phpt +++ b/tests/classes/property_recreate_private.phpt @@ -3,19 +3,19 @@ Unsetting and recreating private properties. --FILE-- <?php class C { - private $p = 'test'; - function unsetPrivate() { - unset($this->p); - } - function setPrivate() { - $this->p = 'changed'; - } + private $p = 'test'; + function unsetPrivate() { + unset($this->p); + } + function setPrivate() { + $this->p = 'changed'; + } } class D extends C { - function setP() { - $this->p = 'changed in D'; - } + function setP() { + $this->p = 'changed in D'; + } } echo "Unset and recreate a superclass's private property:\n"; @@ -49,7 +49,7 @@ $c->unsetPrivate(); $c->p = 'this will fail'; var_dump($c); ?> -==Done== +===DONE=== --EXPECTF-- Unset and recreate a superclass's private property: object(D)#%d (1) { diff --git a/tests/classes/property_recreate_protected.phpt b/tests/classes/property_recreate_protected.phpt index ddbbb71fc9..11c3c7f900 100644 --- a/tests/classes/property_recreate_protected.phpt +++ b/tests/classes/property_recreate_protected.phpt @@ -3,19 +3,19 @@ Unsetting and recreating protected properties. --FILE-- <?php class C { - protected $p = 'test'; - function unsetProtected() { - unset($this->p); - } - function setProtected() { - $this->p = 'changed'; - } + protected $p = 'test'; + function unsetProtected() { + unset($this->p); + } + function setProtected() { + $this->p = 'changed'; + } } class D extends C { - function setP() { - $this->p = 'changed in D'; - } + function setP() { + $this->p = 'changed in D'; + } } $d = new D; diff --git a/tests/classes/protected_001.phpt b/tests/classes/protected_001.phpt index 44099b18fa..026a0f424b 100644 --- a/tests/classes/protected_001.phpt +++ b/tests/classes/protected_001.phpt @@ -4,13 +4,13 @@ ZE2 A protected method can only be called inside the class <?php class pass { - protected static function fail() { - echo "Call fail()\n"; - } + protected static function fail() { + echo "Call fail()\n"; + } - public static function good() { - pass::fail(); - } + public static function good() { + pass::fail(); + } } pass::good(); diff --git a/tests/classes/protected_001b.phpt b/tests/classes/protected_001b.phpt index 6f00ffc1b3..971436c844 100644 --- a/tests/classes/protected_001b.phpt +++ b/tests/classes/protected_001b.phpt @@ -4,13 +4,13 @@ ZE2 A protected method can only be called inside the class <?php class pass { - protected function fail() { - echo "Call fail()\n"; - } + protected function fail() { + echo "Call fail()\n"; + } - public function good() { - $this->fail(); - } + public function good() { + $this->fail(); + } } $t = new pass(); diff --git a/tests/classes/protected_002.phpt b/tests/classes/protected_002.phpt index da87200b6e..f3ddc15db9 100644 --- a/tests/classes/protected_002.phpt +++ b/tests/classes/protected_002.phpt @@ -4,22 +4,22 @@ ZE2 A protected method cannot be called in another class <?php class pass { - protected static function show() { - echo "Call pass::show()\n"; - } + protected static function show() { + echo "Call pass::show()\n"; + } - public static function do_show() { - pass::show(); - } + public static function do_show() { + pass::show(); + } } pass::do_show(); class fail { - public static function show() { - echo "Call fail::show()\n"; - pass::show(); - } + public static function show() { + echo "Call fail::show()\n"; + pass::show(); + } } fail::show(); diff --git a/tests/classes/serialize_001.phpt b/tests/classes/serialize_001.phpt index c228e714e9..e0f7973cd7 100644 --- a/tests/classes/serialize_001.phpt +++ b/tests/classes/serialize_001.phpt @@ -5,48 +5,46 @@ ZE2 Serializable class Test implements Serializable { - public $data; + public $data; - function __construct($data) - { - echo __METHOD__ . "($data)\n"; - $this->data = $data; - } + function __construct($data) + { + echo __METHOD__ . "($data)\n"; + $this->data = $data; + } - function serialize() - { - echo __METHOD__ . "({$this->data})\n"; - return $this->data; - } + function serialize() + { + echo __METHOD__ . "({$this->data})\n"; + return $this->data; + } - function unserialize($serialized) - { - echo __METHOD__ . "($serialized)\n"; - $this->data = $serialized; - var_dump($this); - } + function unserialize($serialized) + { + echo __METHOD__ . "($serialized)\n"; + $this->data = $serialized; + var_dump($this); + } } $tests = array('String', NULL, 42, false); foreach($tests as $data) { - try - { - echo "==========\n"; - var_dump($data); - $ser = serialize(new Test($data)); - var_dump(unserialize($ser)); - } - catch(Exception $e) - { - echo 'Exception: ' . $e->getMessage() . "\n"; - } + try + { + echo "==========\n"; + var_dump($data); + $ser = serialize(new Test($data)); + var_dump(unserialize($ser)); + } + catch(Exception $e) + { + echo 'Exception: ' . $e->getMessage() . "\n"; + } } ?> -===DONE=== -<?php exit(0); ?> --EXPECTF-- ========== string(6) "String" @@ -76,4 +74,3 @@ bool(false) Test::__construct() Test::serialize() Exception: Test::serialize() must return a string or NULL -===DONE=== diff --git a/tests/classes/singleton_001.phpt b/tests/classes/singleton_001.phpt index 45174158be..27d74122e2 100644 --- a/tests/classes/singleton_001.phpt +++ b/tests/classes/singleton_001.phpt @@ -4,24 +4,24 @@ ZE2 singleton <?php class Counter { - private $counter = 0; + private $counter = 0; - function increment_and_print() { - echo ++$this->counter; - echo "\n"; + function increment_and_print() { + echo ++$this->counter; + echo "\n"; } } class SingletonCounter { - private static $m_instance = NULL; + private static $m_instance = NULL; - static function Instance() { - if (self::$m_instance == NULL) { - self::$m_instance = new Counter(); - } - return self::$m_instance; - } + static function Instance() { + if (self::$m_instance == NULL) { + self::$m_instance = new Counter(); + } + return self::$m_instance; + } } SingletonCounter::Instance()->increment_and_print(); diff --git a/tests/classes/static_mix_1.phpt b/tests/classes/static_mix_1.phpt index 8dead36856..01704193cd 100644 --- a/tests/classes/static_mix_1.phpt +++ b/tests/classes/static_mix_1.phpt @@ -4,15 +4,15 @@ ZE2 You cannot overload a static method with a non static method <?php class pass { - static function show() { - echo "Call to function pass::show()\n"; - } + static function show() { + echo "Call to function pass::show()\n"; + } } class fail extends pass { - function show() { - echo "Call to function fail::show()\n"; - } + function show() { + echo "Call to function fail::show()\n"; + } } pass::show(); diff --git a/tests/classes/static_mix_2.phpt b/tests/classes/static_mix_2.phpt index bbf6f9c1dd..7f89ba3987 100644 --- a/tests/classes/static_mix_2.phpt +++ b/tests/classes/static_mix_2.phpt @@ -4,15 +4,15 @@ ZE2 You cannot overload a non static method with a static method <?php class pass { - function show() { - echo "Call to function pass::show()\n"; - } + function show() { + echo "Call to function pass::show()\n"; + } } class fail extends pass { - static function show() { - echo "Call to function fail::show()\n"; - } + static function show() { + echo "Call to function fail::show()\n"; + } } $t = new pass(); diff --git a/tests/classes/static_properties_001.phpt b/tests/classes/static_properties_001.phpt index e5e545fa22..5772a0dbcc 100644 --- a/tests/classes/static_properties_001.phpt +++ b/tests/classes/static_properties_001.phpt @@ -4,7 +4,7 @@ ZE2 Initializing static properties to arrays <?php class test { - static public $ar = array(); + static public $ar = array(); } var_dump(test::$ar); diff --git a/tests/classes/static_properties_003.phpt b/tests/classes/static_properties_003.phpt index 89c26d3dd3..30a6e2a510 100644 --- a/tests/classes/static_properties_003.phpt +++ b/tests/classes/static_properties_003.phpt @@ -25,7 +25,6 @@ var_dump(isset($c->y)); //$c->y = 1; // Fatal error, tested in static_properties_003_error3.phpt //$c->y =& $ref; // Fatal error, tested in static_properties_003_error4.phpt ?> -==Done== --EXPECTF-- --> Access visible static prop like instance prop: bool(false) @@ -34,7 +33,7 @@ Notice: Accessing static property C::$x as non static in %s on line 11 Notice: Accessing static property C::$x as non static in %s on line 12 -Notice: Undefined property: C::$x in %s on line 12 +Warning: Undefined property: C::$x in %s on line %d Notice: Accessing static property C::$x as non static in %s on line 13 @@ -46,4 +45,3 @@ string(5) "C::$x" --> Access non-visible static prop like instance prop: bool(false) -==Done== diff --git a/tests/classes/static_properties_003_error1.phpt b/tests/classes/static_properties_003_error1.phpt index 08a89568e4..fdb91b3e0c 100644 --- a/tests/classes/static_properties_003_error1.phpt +++ b/tests/classes/static_properties_003_error1.phpt @@ -10,7 +10,7 @@ $c = new C; echo "\n--> Access non-visible static prop like instance prop:\n"; unset($c->y); ?> -==Done== +===DONE=== --EXPECTF-- --> Access non-visible static prop like instance prop: diff --git a/tests/classes/static_properties_003_error2.phpt b/tests/classes/static_properties_003_error2.phpt index 45ccff11b6..80e9c0d0c9 100644 --- a/tests/classes/static_properties_003_error2.phpt +++ b/tests/classes/static_properties_003_error2.phpt @@ -10,7 +10,7 @@ $c = new C; echo "\n--> Access non-visible static prop like instance prop:\n"; echo $c->y; ?> -==Done== +===DONE=== --EXPECTF-- --> Access non-visible static prop like instance prop: diff --git a/tests/classes/static_properties_003_error3.phpt b/tests/classes/static_properties_003_error3.phpt index e8588a1160..b35307d814 100644 --- a/tests/classes/static_properties_003_error3.phpt +++ b/tests/classes/static_properties_003_error3.phpt @@ -10,7 +10,7 @@ $c = new C; echo "\n--> Access non-visible static prop like instance prop:\n"; $c->y = 1; ?> -==Done== +===DONE=== --EXPECTF-- --> Access non-visible static prop like instance prop: diff --git a/tests/classes/static_properties_003_error4.phpt b/tests/classes/static_properties_003_error4.phpt index a96ffb2977..ab7c316239 100644 --- a/tests/classes/static_properties_003_error4.phpt +++ b/tests/classes/static_properties_003_error4.phpt @@ -14,10 +14,8 @@ try { echo $e, "\n"; } ?> -==Done== --EXPECTF-- --> Access non-visible static prop like instance prop: Error: Cannot access protected property C::$y in %s:%d Stack trace: #0 {main} -==Done== diff --git a/tests/classes/static_properties_004.phpt b/tests/classes/static_properties_004.phpt index 42860c3301..956b49885d 100644 --- a/tests/classes/static_properties_004.phpt +++ b/tests/classes/static_properties_004.phpt @@ -18,7 +18,6 @@ $ref = 'changed.one'; D::$p =& $ref; var_dump(C::$p, D::$p, E::$p); ?> -==Done== --EXPECT-- Inherited static properties refer to the same value across classes: string(8) "original" @@ -34,4 +33,3 @@ References cannot be used to split the properties: string(11) "changed.one" string(11) "changed.one" string(11) "changed.one" -==Done== diff --git a/tests/classes/static_this.phpt b/tests/classes/static_this.phpt index f7a11f5481..a945d76c9d 100644 --- a/tests/classes/static_this.phpt +++ b/tests/classes/static_this.phpt @@ -5,21 +5,21 @@ ZE2 $this can be an argument to a static function class TestClass { - function __construct() - { - self::Test1(); - $this->Test1(); - } + function __construct() + { + self::Test1(); + $this->Test1(); + } - static function Test1() - { - var_dump($this); - } + static function Test1() + { + var_dump($this); + } - static function Test2($this) - { - var_dump($this); - } + static function Test2($this) + { + var_dump($this); + } } $obj = new TestClass; diff --git a/tests/classes/this.phpt b/tests/classes/this.phpt index 30ea83e285..418ea63912 100644 --- a/tests/classes/this.phpt +++ b/tests/classes/this.phpt @@ -10,7 +10,7 @@ class Foo { function replace($other) { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; $this = $other; print $this->prop; print $other->prop; @@ -18,7 +18,7 @@ class Foo function indirect($other) { - echo __METHOD__ . "\n"; + echo __METHOD__ . "\n"; $this = $other; $result = $this = $other; print $result->prop; @@ -27,8 +27,8 @@ class Foo function retrieve(&$other) { - echo __METHOD__ . "\n"; - $other = $this; + echo __METHOD__ . "\n"; + $other = $this; } } diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt index 418aa1fc25..abf41f97cd 100644 --- a/tests/classes/tostring_001.phpt +++ b/tests/classes/tostring_001.phpt @@ -11,7 +11,7 @@ class test2 { function __toString() { - echo __METHOD__ . "()\n"; + echo __METHOD__ . "()\n"; return "Converted\n"; } } @@ -20,8 +20,8 @@ class test3 { function __toString() { - echo __METHOD__ . "()\n"; - return 42; + echo __METHOD__ . "()\n"; + return []; } } echo "====test1====\n"; @@ -56,7 +56,11 @@ echo $o , $o; echo "====test7====\n"; $ar = array(); $ar[$o->__toString()] = "ERROR"; -echo $ar[$o]; +try { + echo $ar[$o]; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} echo "====test8====\n"; var_dump(trim($o)); @@ -76,7 +80,7 @@ try { ?> ====DONE==== ---EXPECTF-- +--EXPECT-- ====test1==== test1 Object ( @@ -114,8 +118,7 @@ test2::__toString() Converted ====test7==== test2::__toString() - -Warning: Illegal offset type in %s on line %d +Illegal offset type ====test8==== test2::__toString() string(9) "Converted" @@ -125,8 +128,8 @@ string(9) "Converted" test2::__toString() Converted ====test10==== -object(test3)#1 (0) { +object(test3)#2 (0) { } test3::__toString() -Method test3::__toString() must return a string value +test3::__toString(): Return value must be of type string, array returned ====DONE==== diff --git a/tests/classes/tostring_002.phpt b/tests/classes/tostring_002.phpt index 7dda92339e..3977ad883f 100644 --- a/tests/classes/tostring_002.phpt +++ b/tests/classes/tostring_002.phpt @@ -5,15 +5,15 @@ ZE2 __toString() in __destruct class Test { - function __toString() - { - return "Hello\n"; - } + function __toString() + { + return "Hello\n"; + } - function __destruct() - { - echo $this; - } + function __destruct() + { + echo $this; + } } $o = new Test; diff --git a/tests/classes/tostring_003.phpt b/tests/classes/tostring_003.phpt index 4dad51f2cf..87a5fe42e1 100644 --- a/tests/classes/tostring_003.phpt +++ b/tests/classes/tostring_003.phpt @@ -5,26 +5,26 @@ ZE2 __toString() in __destruct/exception class Test { - function __toString() - { - throw new Exception("Damn!"); - return "Hello\n"; - } + function __toString() + { + throw new Exception("Damn!"); + return "Hello\n"; + } - function __destruct() - { - echo $this; - } + function __destruct() + { + echo $this; + } } try { - $o = new Test; - $o = NULL; + $o = new Test; + $o = NULL; } catch(Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/tests/classes/tostring_004.phpt b/tests/classes/tostring_004.phpt index 4134c702b6..48ac2770dd 100644 --- a/tests/classes/tostring_004.phpt +++ b/tests/classes/tostring_004.phpt @@ -2,7 +2,7 @@ Object to string conversion: error cases and behaviour variations. --FILE-- <?php -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg\n"; } set_error_handler('test_error_handler'); @@ -28,9 +28,9 @@ try { echo "\n\nObject with bad __toString():\n"; class badToString { - function __toString() { - return 0; - } + function __toString() { + return []; + } } $obj = new badToString; @@ -53,7 +53,7 @@ try { --EXPECT-- Object with no __toString(): Try 1: -Object of class stdClass could not be converted to string +printf(): Argument #1 ($format) must be of type string, stdClass given Try 2: @@ -62,8 +62,8 @@ Object of class stdClass could not be converted to string Object with bad __toString(): Try 1: -Method badToString::__toString() must return a string value +badToString::__toString(): Return value must be of type string, array returned Try 2: -Method badToString::__toString() must return a string value +badToString::__toString(): Return value must be of type string, array returned diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt index 35356581f4..f1c1973cf3 100644 --- a/tests/classes/type_hinting_001.phpt +++ b/tests/classes/type_hinting_001.phpt @@ -4,21 +4,21 @@ ZE2 class type hinting <?php interface Foo { - function a(Foo $foo); + function a(Foo $foo); } interface Bar { - function b(Bar $bar); + function b(Bar $bar); } class FooBar implements Foo, Bar { - function a(Foo $foo) { - // ... - } + function a(Foo $foo) { + // ... + } - function b(Bar $bar) { - // ... - } + function b(Bar $bar) { + // ... + } } class Blort { @@ -32,7 +32,7 @@ $a->b($b); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: Argument 1 passed to FooBar::a() must implement interface Foo, instance of Blort given, called in %s on line 27 and defined in %s:12 +Fatal error: Uncaught TypeError: FooBar::a(): Argument #1 ($foo) must be of type Foo, Blort given, called in %s on line 27 and defined in %s:12 Stack trace: #0 %s(%d): FooBar->a(Object(Blort)) #1 {main} diff --git a/tests/classes/type_hinting_002.phpt b/tests/classes/type_hinting_002.phpt index b65bc85c93..765de66bab 100644 --- a/tests/classes/type_hinting_002.phpt +++ b/tests/classes/type_hinting_002.phpt @@ -4,14 +4,14 @@ ZE2 class type hinting non existing class <?php class Foo { - function a(NonExisting $foo) {} + function a(NonExisting $foo) {} } $o = new Foo; $o->a($o); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: Argument 1 passed to Foo::a() must be an instance of NonExisting, instance of Foo given, called in %s on line %d and defined in %s:%d +Fatal error: Uncaught TypeError: Foo::a(): Argument #1 ($foo) must be of type NonExisting, Foo given, called in %s on line %d and defined in %s:%d Stack trace: #0 %s(%d): Foo->a(Object(Foo)) #1 {main} diff --git a/tests/classes/type_hinting_003.phpt b/tests/classes/type_hinting_003.phpt index fb788e3d9c..fab088daae 100644 --- a/tests/classes/type_hinting_003.phpt +++ b/tests/classes/type_hinting_003.phpt @@ -5,29 +5,29 @@ ZE2 class type hinting with arrays class Test { - static function f1(array $ar) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f1(array $ar) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } - static function f2(array $ar = NULL) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f2(array $ar = NULL) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } - static function f3(array $ar = array()) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f3(array $ar = array()) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } - static function f4(array $ar = array(25)) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } + static function f4(array $ar = array(25)) + { + echo __METHOD__ . "()\n"; + var_dump($ar); + } } Test::f1(array(42)); @@ -57,7 +57,7 @@ array(1) { int(25) } -Fatal error: Uncaught TypeError: Argument 1 passed to Test::f1() must be of the type array, int given, called in %s on line %d and defined in %s:%d +Fatal error: Uncaught TypeError: Test::f1(): Argument #1 ($ar) must be of type array, int given, called in %s on line %d and defined in %s:%d Stack trace: #0 %s(%d): Test::f1(1) #1 {main} diff --git a/tests/classes/type_hinting_004.phpt b/tests/classes/type_hinting_004.phpt index 27f15a3e16..2ba8870b0a 100644 --- a/tests/classes/type_hinting_004.phpt +++ b/tests/classes/type_hinting_004.phpt @@ -144,10 +144,10 @@ Ensure type hints are enforced for functions invoked as callbacks. ?> --EXPECTF-- ---> Type hints with callback function: -0: Argument 1 passed to f1() must be an instance of A, int given%s(%d) +0: f1(): Argument #1 ($a) must be of type A, int given%s(%d) in f1; -0: Argument 1 passed to f2() must be an instance of A or null, int given%s(%d) +0: f2(): Argument #1 ($a) must be of type ?A, int given%s(%d) in f2; in f2; @@ -155,10 +155,10 @@ in f2; ---> Type hints with callback static method: -0: Argument 1 passed to C::f1() must be an instance of A, int given%s(%d) +0: C::f1(): Argument #1 ($a) must be of type A, int given%s(%d) in C::f1 (static); -0: Argument 1 passed to C::f2() must be an instance of A or null, int given%s(%d) +0: C::f2(): Argument #1 ($a) must be of type ?A, int given%s(%d) in C::f2 (static); in C::f2 (static); @@ -166,10 +166,10 @@ in C::f2 (static); ---> Type hints with callback instance method: -0: Argument 1 passed to D::f1() must be an instance of A, int given%s(%d) +0: D::f1(): Argument #1 ($a) must be of type A, int given%s(%d) in C::f1 (instance); -0: Argument 1 passed to D::f2() must be an instance of A or null, int given%s(%d) +0: D::f2(): Argument #1 ($a) must be of type ?A, int given%s(%d) in C::f2 (instance); in C::f2 (instance); diff --git a/tests/classes/type_hinting_005a.phpt b/tests/classes/type_hinting_005a.phpt index 54af0e8c96..065ba70e8a 100644 --- a/tests/classes/type_hinting_005a.phpt +++ b/tests/classes/type_hinting_005a.phpt @@ -4,15 +4,11 @@ Check type hint compatibility in overrides with array hints. <?php Class C { function f(array $a) {} } -echo "Compatible hint.\n"; +// Compatible hint. Class D1 extends C { function f(array $a) {} } -echo "Class hint, should be array.\n"; +// Class hint, should be array. Class D2 extends C { function f(SomeClass $a) {} } ?> -==DONE== --EXPECTF-- -Warning: Declaration of D2::f(SomeClass $a) should be compatible with C::f(array $a) in %s on line 8 -Compatible hint. -Class hint, should be array. -==DONE== +Fatal error: Declaration of D2::f(SomeClass $a) must be compatible with C::f(array $a) in %s on line 8 diff --git a/tests/classes/type_hinting_005c.phpt b/tests/classes/type_hinting_005c.phpt index 00048c3ef9..6cc3e3e369 100644 --- a/tests/classes/type_hinting_005c.phpt +++ b/tests/classes/type_hinting_005c.phpt @@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints. <?php Class C { function f(SomeClass $a) {} } -echo "Array hint, should be class.\n"; +// Array hint, should be class. Class D extends C { function f(array $a) {} } ?> -==DONE== --EXPECTF-- -Warning: Declaration of D::f(array $a) should be compatible with C::f(SomeClass $a) in %s on line 5 -Array hint, should be class. -==DONE== +Fatal error: Declaration of D::f(array $a) must be compatible with C::f(SomeClass $a) in %s on line 5 diff --git a/tests/classes/type_hinting_005d.phpt b/tests/classes/type_hinting_005d.phpt index a1ce30950c..51c2a5a995 100644 --- a/tests/classes/type_hinting_005d.phpt +++ b/tests/classes/type_hinting_005d.phpt @@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints. <?php Class C { function f($a) {} } -echo "Array hint, should be nothing.\n"; +// Array hint, should be nothing. Class D extends C { function f(array $a) {} } ?> -==DONE== --EXPECTF-- -Warning: Declaration of D::f(array $a) should be compatible with C::f($a) in %s on line 5 -Array hint, should be nothing. -==DONE== +Fatal error: Declaration of D::f(array $a) must be compatible with C::f($a) in %s on line 5 diff --git a/tests/classes/unset_properties.phpt b/tests/classes/unset_properties.phpt index 417542ddea..fa576713d5 100644 --- a/tests/classes/unset_properties.phpt +++ b/tests/classes/unset_properties.phpt @@ -6,68 +6,68 @@ methods themselves. class Test { - public $publicProperty = 'publicProperty set'; - - protected $protectedProperty = 'protectedProperty set'; - - private $privateProperty = 'privateProperty set'; - - public function __get($name) - { - return '__get "' . $name . '"'; - } - - public function __set($name, $value) - { - $this->$name = $value; - echo '__set "' . $name . '" to "' . $value . '"'; - } - - public function __isset($name) - { - echo '__isset "' . $name . '"'; - return isset($this->$name); - } - - public function getPublicProperty() - { - return $this->publicProperty; - } - - public function setPublicProperty($publicProperty) - { - $this->publicProperty = $publicProperty; - } - - public function unsetProtectedProperty() - { - unset($this->protectedProperty); - } - - public function getProtectedProperty() - { - return $this->protectedProperty; - } - - public function setProtectedProperty($protectedProperty) - { - $this->protectedProperty = $protectedProperty; - } - - public function unsetPrivateProperty() - { - unset($this->privateProperty); - } - - public function getPrivateProperty() - { - return $this->privateProperty; - } - - public function setPrivateProperty($privateProperty) - { - $this->privateProperty = $privateProperty; - } + public $publicProperty = 'publicProperty set'; + + protected $protectedProperty = 'protectedProperty set'; + + private $privateProperty = 'privateProperty set'; + + public function __get($name) + { + return '__get "' . $name . '"'; + } + + public function __set($name, $value) + { + $this->$name = $value; + echo '__set "' . $name . '" to "' . $value . '"'; + } + + public function __isset($name) + { + echo '__isset "' . $name . '"'; + return isset($this->$name); + } + + public function getPublicProperty() + { + return $this->publicProperty; + } + + public function setPublicProperty($publicProperty) + { + $this->publicProperty = $publicProperty; + } + + public function unsetProtectedProperty() + { + unset($this->protectedProperty); + } + + public function getProtectedProperty() + { + return $this->protectedProperty; + } + + public function setProtectedProperty($protectedProperty) + { + $this->protectedProperty = $protectedProperty; + } + + public function unsetPrivateProperty() + { + unset($this->privateProperty); + } + + public function getPrivateProperty() + { + return $this->privateProperty; + } + + public function setPrivateProperty($privateProperty) + { + $this->privateProperty = $privateProperty; + } } // verifying public property diff --git a/tests/classes/visibility_000a.phpt b/tests/classes/visibility_000a.phpt index 00e918ad30..276e7a9f79 100644 --- a/tests/classes/visibility_000a.phpt +++ b/tests/classes/visibility_000a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f0() {} + protected function f0() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_000b.phpt b/tests/classes/visibility_000b.phpt index aeb3078b72..56e5fd9c27 100644 --- a/tests/classes/visibility_000b.phpt +++ b/tests/classes/visibility_000b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f0() {} + private function f0() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_000c.phpt b/tests/classes/visibility_000c.phpt index d1a7c9f1e1..c56311d72b 100644 --- a/tests/classes/visibility_000c.phpt +++ b/tests/classes/visibility_000c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f0() {} + function f0() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_001a.phpt b/tests/classes/visibility_001a.phpt index 50baf64d67..bb1a7c2714 100644 --- a/tests/classes/visibility_001a.phpt +++ b/tests/classes/visibility_001a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f1() {} + protected function f1() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_001b.phpt b/tests/classes/visibility_001b.phpt index 626b5303f8..666a530f36 100644 --- a/tests/classes/visibility_001b.phpt +++ b/tests/classes/visibility_001b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f1() {} + private function f1() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_001c.phpt b/tests/classes/visibility_001c.phpt index 956c6762df..8185beddc2 100644 --- a/tests/classes/visibility_001c.phpt +++ b/tests/classes/visibility_001c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f1() {} + function f1() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_002a.phpt b/tests/classes/visibility_002a.phpt index 2fd402070d..c1a93482a5 100644 --- a/tests/classes/visibility_002a.phpt +++ b/tests/classes/visibility_002a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f2() {} + protected function f2() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_002b.phpt b/tests/classes/visibility_002b.phpt index a8b1c5e79e..a46386d19c 100644 --- a/tests/classes/visibility_002b.phpt +++ b/tests/classes/visibility_002b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f2() {} + private function f2() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_002c.phpt b/tests/classes/visibility_002c.phpt index 64560171cc..406a16dd20 100644 --- a/tests/classes/visibility_002c.phpt +++ b/tests/classes/visibility_002c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f2() {} + function f2() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_003a.phpt b/tests/classes/visibility_003a.phpt index 17f5b49eb9..4a9bb97f9c 100644 --- a/tests/classes/visibility_003a.phpt +++ b/tests/classes/visibility_003a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - public function f3() {} + public function f3() {} } echo "Done\n"; diff --git a/tests/classes/visibility_003b.phpt b/tests/classes/visibility_003b.phpt index 474e0df235..504408e68f 100644 --- a/tests/classes/visibility_003b.phpt +++ b/tests/classes/visibility_003b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - private function f3() {} + private function f3() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_003c.phpt b/tests/classes/visibility_003c.phpt index 7ac3239f59..e396331110 100644 --- a/tests/classes/visibility_003c.phpt +++ b/tests/classes/visibility_003c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f3() {} + function f3() {} } echo "Done\n"; diff --git a/tests/classes/visibility_004a.phpt b/tests/classes/visibility_004a.phpt index a6acb40569..115d5d743e 100644 --- a/tests/classes/visibility_004a.phpt +++ b/tests/classes/visibility_004a.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - public function f4() {} + public function f4() {} } echo "Done\n"; diff --git a/tests/classes/visibility_004b.phpt b/tests/classes/visibility_004b.phpt index 9e416fc6ae..203ae878ff 100644 --- a/tests/classes/visibility_004b.phpt +++ b/tests/classes/visibility_004b.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - protected function f4() {} + protected function f4() {} } echo "Done\n"; // shouldn't be displayed diff --git a/tests/classes/visibility_004c.phpt b/tests/classes/visibility_004c.phpt index abe25b1b39..b2d0939bb9 100644 --- a/tests/classes/visibility_004c.phpt +++ b/tests/classes/visibility_004c.phpt @@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility <?php class father { - function f0() {} - function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + function f0() {} + function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class same extends father { - // overload fn with same visibility - function f0() {} - public function f1() {} - public function f2() {} - protected function f3() {} - private function f4() {} + // overload fn with same visibility + function f0() {} + public function f1() {} + public function f2() {} + protected function f3() {} + private function f4() {} } class fail extends same { - function f4() {} + function f4() {} } echo "Done\n"; diff --git a/tests/classes/visibility_005.phpt b/tests/classes/visibility_005.phpt index 859a5f7b6c..ac7a2dd35a 100644 --- a/tests/classes/visibility_005.phpt +++ b/tests/classes/visibility_005.phpt @@ -5,16 +5,16 @@ ZE2 foreach and property visibility class base { - public $a=1; - protected $b=2; - private $c=3; + public $a=1; + protected $b=2; + private $c=3; - function f() - { - foreach($this as $k=>$v) { - echo "$k=>$v\n"; - } - } + function f() + { + foreach($this as $k=>$v) { + echo "$k=>$v\n"; + } + } } class derived extends base @@ -27,7 +27,7 @@ echo "===base::function===\n"; $o->f(); echo "===base,foreach===\n"; foreach($o as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } $o = new derived; @@ -36,7 +36,7 @@ echo "===derived::function===\n"; $o->f(); echo "===derived,foreach===\n"; foreach($o as $k=>$v) { - echo "$k=>$v\n"; + echo "$k=>$v\n"; } ?> |