diff options
Diffstat (limited to 'tests/classes')
171 files changed, 0 insertions, 7308 deletions
diff --git a/tests/classes/__call_001.phpt b/tests/classes/__call_001.phpt deleted file mode 100644 index f9708e04f1..0000000000 --- a/tests/classes/__call_001.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -ZE2 __call() ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Caller { - public $x = array(1, 2, 3); - - function __call($m, $a) { - echo "Method $m called:\n"; - var_dump($a); - return $this->x; - } -} - -$foo = new Caller(); -$a = $foo->test(1, '2', 3.4, true); -var_dump($a); - -?> ---EXPECT-- -Method test called: -array(4) { - [0]=> - int(1) - [1]=> - string(1) "2" - [2]=> - float(3.4) - [3]=> - bool(true) -} -array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) -} diff --git a/tests/classes/__call_002.phpt b/tests/classes/__call_002.phpt deleted file mode 100755 index 53a179f787..0000000000 --- a/tests/classes/__call_002.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -ZE2 __call() signature check ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Test { - function __call() { - } -} - -?> ---EXPECTF-- -Fatal error: Method Test::__call() must take exactly 2 arguments in %s__call_002.php on line %d diff --git a/tests/classes/__set__get_001.phpt b/tests/classes/__set__get_001.phpt deleted file mode 100644 index beb688c222..0000000000 --- a/tests/classes/__set__get_001.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -ZE2 __set() and __get() ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class setter { - public $n; - public $x = array('a' => 1, 'b' => 2, 'c' => 3); - - 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"; - } - } - - 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"; - } - } -} - -$foo = new Setter(); - -// this doesn't go through __set()... should it? -$foo->n = 1; - -// the rest are fine... -$foo->a = 100; -$foo->a++; -$foo->z++; -var_dump($foo); - -?> ---EXPECTF-- -Setting [a] to 100 -OK! -Getting [a] -Returning: 100 -Setting [a] to 101 -OK! -Getting [z] -Nothing! -Setting [z] to 1 -Not OK! -object(setter)#%d (2) { - ["n"]=> - int(1) - ["x"]=> - array(3) { - ["a"]=> - int(101) - ["b"]=> - int(2) - ["c"]=> - int(3) - } -} diff --git a/tests/classes/__set__get_002.phpt b/tests/classes/__set__get_002.phpt deleted file mode 100755 index 71111ccdf8..0000000000 --- a/tests/classes/__set__get_002.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -ZE2 __get() signature check ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class Test { - function __get($x,$y) { - } -} - -?> ---EXPECTF-- -Fatal error: Method Test::__get() must take exactly 1 argument in %s__set__get_002.php on line %d diff --git a/tests/classes/__set__get_003.phpt b/tests/classes/__set__get_003.phpt deleted file mode 100755 index 390d303362..0000000000 --- a/tests/classes/__set__get_003.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -ZE2 __set() signature check ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class Test { - function __set() { - } -} - -?> ---EXPECTF-- -Fatal error: Method Test::__set() must take exactly 2 arguments in %s__set__get_003.php on line %d diff --git a/tests/classes/__set__get_004.phpt b/tests/classes/__set__get_004.phpt deleted file mode 100755 index e3061da4f0..0000000000 --- a/tests/classes/__set__get_004.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -ZE2 __set() and __get() ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class Test { - protected $x; - - function __get($name) { - if (isset($this->x[$name])) { - return $this->x[$name]; - } - else - { - return NULL; - } - } - - function __set($name, $val) { - $this->x[$name] = $val; - } -} - -$foo = new Test(); -$bar = new Test(); -$bar->baz = "Check"; - -$foo->bar = $bar; - -var_dump($bar->baz); -var_dump($foo->bar->baz); - -?> -===DONE=== ---EXPECTF-- -string(5) "Check" -string(5) "Check" -===DONE=== diff --git a/tests/classes/__set__get_005.phpt b/tests/classes/__set__get_005.phpt deleted file mode 100755 index 1a55334060..0000000000 --- a/tests/classes/__set__get_005.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -ZE2 __set() and __get() ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class Test -{ - protected $x; - - 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; - } -} - -class AutoGen -{ - protected $x; - - 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; - } -} - -$foo = new AutoGen(); -$foo->bar->baz = "Check"; - -var_dump($foo->bar); -var_dump($foo->bar->baz); - -?> -===DONE=== ---EXPECTF-- -AutoGen::__get -Test::__set -AutoGen::__get -object(Test)#%d (1) { - ["x:protected"]=> - array(1) { - ["baz"]=> - string(5) "Check" - } -} -AutoGen::__get -Test::__get -string(5) "Check" -===DONE=== diff --git a/tests/classes/__set_data_corrupt.phpt b/tests/classes/__set_data_corrupt.phpt deleted file mode 100644 index 6a52bd489b..0000000000 --- a/tests/classes/__set_data_corrupt.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -ZE2 Data corruption in __set ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?> ---FILE-- -<?php -$f = 'c="foo"'; -class foo { - const foobar=1; - public $pp = array('t'=>null); - - function bar() { - echo $this->t ='f'; - } - function __get($prop) - { - return $this->pp[$prop]; - } - function __set($prop, $val) - { - echo "__set"; - $this->pp[$prop] = ''; - } -} -$f = new foo; -$f->bar(); -?> ---EXPECT-- -__setf diff --git a/tests/classes/abstract.phpt b/tests/classes/abstract.phpt deleted file mode 100644 index fbebf4da73..0000000000 --- a/tests/classes/abstract.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ZE2 An abstract method may not be called ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -abstract class fail { - abstract function show(); -} - -class pass extends fail { - function show() { - echo "Call to function show()\n"; - } - function error() { - parent::show(); - } -} - -$t = new pass(); -$t->show(); -$t->error(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call to function show() - -Fatal error: Cannot call abstract method fail::show() in %s on line %d diff --git a/tests/classes/abstract_by_interface_001.phpt b/tests/classes/abstract_by_interface_001.phpt deleted file mode 100755 index 7565fdf45f..0000000000 --- a/tests/classes/abstract_by_interface_001.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 An abstract method may not be called ---FILE-- -<?php - -class Root { -} - -interface MyInterface -{ - function MyInterfaceFunc(); -} - -abstract class Derived extends Root implements MyInterface { -} - -class Leaf extends Derived -{ - function MyInterfaceFunc() {} -} - -var_dump(new Leaf); - -class Fails extends Root implements MyInterface { -} - -?> -===DONE=== ---EXPECTF-- -object(Leaf)#%d (0) { -} - -Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_001.php on line %d diff --git a/tests/classes/abstract_by_interface_002.phpt b/tests/classes/abstract_by_interface_002.phpt deleted file mode 100755 index 77c5619dfe..0000000000 --- a/tests/classes/abstract_by_interface_002.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 An abstract method may not be called ---FILE-- -<?php - -class Root { -} - -interface MyInterface -{ - static function MyInterfaceFunc(); -} - -abstract class Derived extends Root implements MyInterface { -} - -class Leaf extends Derived -{ - static function MyInterfaceFunc() {} -} - -var_dump(new Leaf); - -class Fails extends Root implements MyInterface { -} - -?> -===DONE=== ---EXPECTF-- -object(Leaf)#%d (0) { -} - -Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_002.php on line %d diff --git a/tests/classes/abstract_class.phpt b/tests/classes/abstract_class.phpt deleted file mode 100644 index 571a9b9581..0000000000 --- a/tests/classes/abstract_class.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -ZE2 An abstract class cannot be instantiated ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -abstract class fail { - abstract function show(); -} - -class pass extends fail { - function show() { - echo "Call to function show()\n"; - } -} - -$t2 = new pass(); -$t2->show(); - -$t = new fail(); -$t->show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call to function show() - -Fatal error: Cannot instantiate abstract class fail in %s on line %d diff --git a/tests/classes/abstract_derived.phpt b/tests/classes/abstract_derived.phpt deleted file mode 100644 index 0feceac6bb..0000000000 --- a/tests/classes/abstract_derived.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -ZE2 A derived class with an abstract method must be abstract ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class base { -} - -class derived extends base { - 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 deleted file mode 100644 index 20c7ae375f..0000000000 --- a/tests/classes/abstract_final.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -ZE2 A final method cannot be abstract ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class fail { - abstract final function show(); -} - -echo "Done\n"; // Shouldn't be displayed -?> ---EXPECTF-- - -Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d diff --git a/tests/classes/abstract_inherit.phpt b/tests/classes/abstract_inherit.phpt deleted file mode 100644 index 362ccb0b76..0000000000 --- a/tests/classes/abstract_inherit.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -ZE2 A class that inherits an abstract method is abstract ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -abstract class pass { - abstract function show(); -} - -abstract class fail extends pass { -} - -$t = new fail(); -$t = new pass(); - -echo "Done\n"; // Shouldn't be displayed -?> ---EXPECTF-- - -Fatal error: Cannot instantiate abstract class fail in %s on line %d diff --git a/tests/classes/abstract_not_declared.phpt b/tests/classes/abstract_not_declared.phpt deleted file mode 100644 index 3b81cd4980..0000000000 --- a/tests/classes/abstract_not_declared.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -ZE2 An abstract class must be declared abstract ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class fail { - abstract function show(); -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::show) in %s on line %d diff --git a/tests/classes/abstract_redeclare.phpt b/tests/classes/abstract_redeclare.phpt deleted file mode 100644 index 9a0a1edc3c..0000000000 --- a/tests/classes/abstract_redeclare.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -ZE2 A method cannot be redeclared abstract ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - function show() { - echo "Call to function show()\n"; - } -} - -class fail extends pass { - abstract function show(); -} - -echo "Done\n"; // Shouldn't be displayed -?> ---EXPECTF-- - -Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::show) in %sabstract_redeclare.php on line %d diff --git a/tests/classes/abstract_static.phpt b/tests/classes/abstract_static.phpt deleted file mode 100644 index 17449eb979..0000000000 --- a/tests/classes/abstract_static.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -ZE2 A static abstract methods ---FILE-- -<?php - -interface showable -{ - static function show(); -} - -class pass implements showable -{ - static function show() { - echo "Call to function show()\n"; - } -} - -pass::show(); - -eval(' -class fail -{ - abstract static function func(); -} -'); - -fail::show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call to function show() - -Fatal error: Static function fail::func() cannot be abstract in %s on line %d diff --git a/tests/classes/abstract_user_call.phpt b/tests/classes/abstract_user_call.phpt deleted file mode 100755 index 0e1ddbe796..0000000000 --- a/tests/classes/abstract_user_call.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ZE2 An abstrcat method cannot be called indirectly ---FILE-- -<?php - -abstract class test_base -{ - abstract function func(); -} - -class test extends test_base -{ - function func() - { - echo __METHOD__ . "()\n"; - } -} - -$o = new test; - -$o->func(); - -call_user_func(array($o, 'test_base::func')); - -?> -===DONE=== ---EXPECTF-- -test::func() - -Fatal error: Cannot call abstract method test_base::func() in %s on line %d diff --git a/tests/classes/array_access_001.phpt b/tests/classes/array_access_001.phpt deleted file mode 100644 index 82f96d5239..0000000000 --- a/tests/classes/array_access_001.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -ZE2 ArrayAccess ---FILE-- -<?php -class object implements ArrayAccess { - - 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]); - } -} - -$obj = new Object; - -var_dump($obj->a); - -echo "===EMPTY===\n"; -var_dump(empty($obj[0])); -var_dump(empty($obj[1])); -var_dump(empty($obj[2])); -var_dump(empty($obj['4th'])); -var_dump(empty($obj['5th'])); -var_dump(empty($obj[6])); - -echo "===isset===\n"; -var_dump(isset($obj[0])); -var_dump(isset($obj[1])); -var_dump(isset($obj[2])); -var_dump(isset($obj['4th'])); -var_dump(isset($obj['5th'])); -var_dump(isset($obj[6])); - -echo "===offsetGet===\n"; -var_dump($obj[0]); -var_dump($obj[1]); -var_dump($obj[2]); -var_dump($obj['4th']); -var_dump($obj['5th']); -var_dump($obj[6]); - -echo "===offsetSet===\n"; -echo "WRITE 1\n"; -$obj[1] = 'Changed 1'; -var_dump($obj[1]); -echo "WRITE 2\n"; -$obj['4th'] = 'Changed 4th'; -var_dump($obj['4th']); -echo "WRITE 3\n"; -$obj['5th'] = 'Added 5th'; -var_dump($obj['5th']); -echo "WRITE 4\n"; -$obj[6] = 'Added 6'; -var_dump($obj[6]); - -var_dump($obj[0]); -var_dump($obj[2]); - -$x = $obj[6] = 'changed 6'; -var_dump($obj[6]); -var_dump($x); - -echo "===unset===\n"; -var_dump($obj->a); -unset($obj[2]); -unset($obj['4th']); -unset($obj[7]); -unset($obj['8th']); -var_dump($obj->a); - -?> -===DONE=== ---EXPECTF-- -array(4) { - [0]=> - string(3) "1st" - [1]=> - int(1) - [2]=> - string(3) "3rd" - ["4th"]=> - int(4) -} -===EMPTY=== -object::offsetExists(0) -object::offsetGet(0) -bool(false) -object::offsetExists(1) -object::offsetGet(1) -bool(false) -object::offsetExists(2) -object::offsetGet(2) -bool(false) -object::offsetExists(4th) -object::offsetGet(4th) -bool(false) -object::offsetExists(5th) -bool(true) -object::offsetExists(6) -bool(true) -===isset=== -object::offsetExists(0) -bool(true) -object::offsetExists(1) -bool(true) -object::offsetExists(2) -bool(true) -object::offsetExists(4th) -bool(true) -object::offsetExists(5th) -bool(false) -object::offsetExists(6) -bool(false) -===offsetGet=== -object::offsetGet(0) -string(3) "1st" -object::offsetGet(1) -int(1) -object::offsetGet(2) -string(3) "3rd" -object::offsetGet(4th) -int(4) -object::offsetGet(5th) - -Notice: Undefined index: 5th in %sarray_access_001.php on line %d -NULL -object::offsetGet(6) - -Notice: Undefined offset: 6 in %sarray_access_001.php on line %d -NULL -===offsetSet=== -WRITE 1 -object::offsetSet(1,Changed 1) -object::offsetGet(1) -string(9) "Changed 1" -WRITE 2 -object::offsetSet(4th,Changed 4th) -object::offsetGet(4th) -string(11) "Changed 4th" -WRITE 3 -object::offsetSet(5th,Added 5th) -object::offsetGet(5th) -string(9) "Added 5th" -WRITE 4 -object::offsetSet(6,Added 6) -object::offsetGet(6) -string(7) "Added 6" -object::offsetGet(0) -string(3) "1st" -object::offsetGet(2) -string(3) "3rd" -object::offsetSet(6,changed 6) -object::offsetGet(6) -string(9) "changed 6" -string(9) "changed 6" -===unset=== -array(6) { - [0]=> - string(3) "1st" - [1]=> - string(9) "Changed 1" - [2]=> - string(3) "3rd" - ["4th"]=> - string(11) "Changed 4th" - ["5th"]=> - string(9) "Added 5th" - [6]=> - string(9) "changed 6" -} -object::offsetUnset(2) -object::offsetUnset(4th) -object::offsetUnset(7) -object::offsetUnset(8th) -array(4) { - [0]=> - string(3) "1st" - [1]=> - string(9) "Changed 1" - ["5th"]=> - string(9) "Added 5th" - [6]=> - string(9) "changed 6" -} -===DONE=== diff --git a/tests/classes/array_access_002.phpt b/tests/classes/array_access_002.phpt deleted file mode 100644 index fd08eb3946..0000000000 --- a/tests/classes/array_access_002.phpt +++ /dev/null @@ -1,198 +0,0 @@ ---TEST-- -ZE2 ArrayAccess::offsetSet without return ---FILE-- -<?php -class object implements ArrayAccess { - - 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]); - } -} - -$obj = new Object; - -var_dump($obj->a); - -echo "===EMPTY===\n"; -var_dump(empty($obj[0])); -var_dump(empty($obj[1])); -var_dump(empty($obj[2])); -var_dump(empty($obj['4th'])); -var_dump(empty($obj['5th'])); -var_dump(empty($obj[6])); - -echo "===isset===\n"; -var_dump(isset($obj[0])); -var_dump(isset($obj[1])); -var_dump(isset($obj[2])); -var_dump(isset($obj['4th'])); -var_dump(isset($obj['5th'])); -var_dump(isset($obj[6])); - -echo "===offsetGet===\n"; -var_dump($obj[0]); -var_dump($obj[1]); -var_dump($obj[2]); -var_dump($obj['4th']); -var_dump($obj['5th']); -var_dump($obj[6]); - -echo "===offsetSet===\n"; -echo "WRITE 1\n"; -$obj[1] = 'Changed 1'; -var_dump($obj[1]); -echo "WRITE 2\n"; -$obj['4th'] = 'Changed 4th'; -var_dump($obj['4th']); -echo "WRITE 3\n"; -$obj['5th'] = 'Added 5th'; -var_dump($obj['5th']); -echo "WRITE 4\n"; -$obj[6] = 'Added 6'; -var_dump($obj[6]); - -var_dump($obj[0]); -var_dump($obj[2]); - -$x = $obj[6] = 'changed 6'; -var_dump($obj[6]); -var_dump($x); - -echo "===unset===\n"; -var_dump($obj->a); -unset($obj[2]); -unset($obj['4th']); -unset($obj[7]); -unset($obj['8th']); -var_dump($obj->a); - -?> -===DONE=== ---EXPECTF-- -array(4) { - [0]=> - string(3) "1st" - [1]=> - int(1) - [2]=> - string(3) "3rd" - ["4th"]=> - int(4) -} -===EMPTY=== -object::offsetExists(0) -object::offsetGet(0) -bool(false) -object::offsetExists(1) -object::offsetGet(1) -bool(false) -object::offsetExists(2) -object::offsetGet(2) -bool(false) -object::offsetExists(4th) -object::offsetGet(4th) -bool(false) -object::offsetExists(5th) -bool(true) -object::offsetExists(6) -bool(true) -===isset=== -object::offsetExists(0) -bool(true) -object::offsetExists(1) -bool(true) -object::offsetExists(2) -bool(true) -object::offsetExists(4th) -bool(true) -object::offsetExists(5th) -bool(false) -object::offsetExists(6) -bool(false) -===offsetGet=== -object::offsetGet(0) -string(3) "1st" -object::offsetGet(1) -int(1) -object::offsetGet(2) -string(3) "3rd" -object::offsetGet(4th) -int(4) -object::offsetGet(5th) - -Notice: Undefined index: 5th in %sarray_access_002.php on line %d -NULL -object::offsetGet(6) - -Notice: Undefined offset: 6 in %sarray_access_002.php on line %d -NULL -===offsetSet=== -WRITE 1 -object::offsetSet(1,Changed 1) -object::offsetGet(1) -string(9) "Changed 1" -WRITE 2 -object::offsetSet(4th,Changed 4th) -object::offsetGet(4th) -string(11) "Changed 4th" -WRITE 3 -object::offsetSet(5th,Added 5th) -object::offsetGet(5th) -string(9) "Added 5th" -WRITE 4 -object::offsetSet(6,Added 6) -object::offsetGet(6) -string(7) "Added 6" -object::offsetGet(0) -string(3) "1st" -object::offsetGet(2) -string(3) "3rd" -object::offsetSet(6,changed 6) -object::offsetGet(6) -string(9) "changed 6" -string(9) "changed 6" -===unset=== -array(6) { - [0]=> - string(3) "1st" - [1]=> - string(9) "Changed 1" - [2]=> - string(3) "3rd" - ["4th"]=> - string(11) "Changed 4th" - ["5th"]=> - string(9) "Added 5th" - [6]=> - string(9) "changed 6" -} -object::offsetUnset(2) -object::offsetUnset(4th) -object::offsetUnset(7) -object::offsetUnset(8th) -array(4) { - [0]=> - string(3) "1st" - [1]=> - string(9) "Changed 1" - ["5th"]=> - string(9) "Added 5th" - [6]=> - string(9) "changed 6" -} -===DONE=== diff --git a/tests/classes/array_access_003.phpt b/tests/classes/array_access_003.phpt deleted file mode 100644 index 2d42665fc6..0000000000 --- a/tests/classes/array_access_003.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -ZE2 ArrayAccess::offsetGet ambiguties ---INI-- -error_reporting=4095 ---FILE-- -<?php -class object implements ArrayAccess { - - 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]); - } -} - -$obj = new Object; - -var_dump($obj[1]); -var_dump($obj[2]); -$obj[2]++; -var_dump($obj[2]); - -?> -===DONE=== ---EXPECTF-- -object::offsetGet(1) -string(6) "fooBar" -object::offsetGet(2) -int(1) -object::offsetGet(2) - -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_003.php on line %d diff --git a/tests/classes/array_access_004.phpt b/tests/classes/array_access_004.phpt deleted file mode 100644 index 17f5b7c404..0000000000 --- a/tests/classes/array_access_004.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -ZE2 ArrayAccess::offsetGet ambiguties ---FILE-- -<?php -class object implements ArrayAccess { - - 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]); - } -} - -$obj = new Object; - -var_dump($obj[1]); -var_dump($obj[2]); -$obj[2]++; -var_dump($obj[2]); - -?> -===DONE=== ---EXPECTF-- -object::offsetGet(1) -string(6) "fooBar" -object::offsetGet(2) -int(1) -object::offsetGet(2) - -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_004.php on line %d diff --git a/tests/classes/array_access_005.phpt b/tests/classes/array_access_005.phpt deleted file mode 100755 index f248f2172c..0000000000 --- a/tests/classes/array_access_005.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and sub Arrays ---FILE-- -<?php - -class Peoples implements ArrayAccess { - public $person; - - function __construct() { - $this->person = array(array('name'=>'Joe')); - } - - function offsetExists($index) { - return array_key_exists($this->person, $index); - } - - function offsetGet($index) { - return $this->person[$index]; - } - - function offsetSet($index, $value) { - $this->person[$index] = $value; - } - - function offsetUnset($index) { - unset($this->person[$index]); - } -} - -$people = new Peoples; - -var_dump($people->person[0]['name']); -$people->person[0]['name'] = $people->person[0]['name'] . 'Foo'; -var_dump($people->person[0]['name']); -$people->person[0]['name'] .= 'Bar'; -var_dump($people->person[0]['name']); - -echo "---ArrayOverloading---\n"; - -$people = new Peoples; - -var_dump($people[0]); -var_dump($people[0]['name']); -var_dump($people->person[0]['name'] . 'Foo'); // impossible to assign this since we don't return references here -$x = $people[0]; // creates a copy -$x['name'] .= 'Foo'; -$people[0] = $x; -var_dump($people[0]); -$people[0]['name'] = 'JoeFoo'; -var_dump($people[0]['name']); -$people[0]['name'] = 'JoeFooBar'; -var_dump($people[0]['name']); - -?> -===DONE=== ---EXPECTF-- -string(3) "Joe" -string(6) "JoeFoo" -string(9) "JoeFooBar" ----ArrayOverloading--- -array(1) { - ["name"]=> - string(3) "Joe" -} -string(3) "Joe" -string(6) "JoeFoo" -array(1) { - ["name"]=> - string(6) "JoeFoo" -} - -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_005.php on line %d diff --git a/tests/classes/array_access_006.phpt b/tests/classes/array_access_006.phpt deleted file mode 100644 index 342a7e5107..0000000000 --- a/tests/classes/array_access_006.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and ASSIGN_OP operators (+=) ---FILE-- -<?php - -class OverloadedArray implements ArrayAccess { - public $realArray; - - function __construct() { - $this->realArray = array(1,2,3); - } - - function offsetExists($index) { - return array_key_exists($this->realArray, $index); - } - - function offsetGet($index) { - return $this->realArray[$index]; - } - - function offsetSet($index, $value) { - $this->realArray[$index] = $value; - } - - function offsetUnset($index) { - unset($this->realArray[$index]); - } -} - -$a = new OverloadedArray; -$a[1] += 10; -var_dump($a[1]); -echo "---Done---\n"; -?> ---EXPECT-- -int(12) ----Done--- diff --git a/tests/classes/array_access_007.phpt b/tests/classes/array_access_007.phpt deleted file mode 100755 index 42187fe5d5..0000000000 --- a/tests/classes/array_access_007.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and [] assignment ---FILE-- -<?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); - } -} - -$a = new OverloadedArray; -$a[] = 1; -$a[1] = 2; -$a[2] = 3; -$a[] = 4; -$a->dump(); -?> -===DONE=== ---EXPECT-- -array(4) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) -} -===DONE=== diff --git a/tests/classes/array_access_008.phpt b/tests/classes/array_access_008.phpt deleted file mode 100755 index 0130388245..0000000000 --- a/tests/classes/array_access_008.phpt +++ /dev/null @@ -1,59 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and ASSIGN_OP operators (.=) ---FILE-- -<?php - -class Peoples implements ArrayAccess { - public $person; - - function __construct() { - $this->person = array(array('name'=>'Foo')); - } - - function offsetExists($index) { - return array_key_exists($this->person, $index); - } - - function offsetGet($index) { - return $this->person[$index]; - } - - function offsetSet($index, $value) { - $this->person[$index] = $value; - } - - function offsetUnset($index) { - unset($this->person[$index]); - } -} - -$people = new Peoples; - -var_dump($people->person[0]['name']); -$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people->person[0]['name']); -$people->person[0]['name'] .= 'Baz'; -var_dump($people->person[0]['name']); - -echo "===ArrayOverloading===\n"; - -$people = new Peoples; - -var_dump($people[0]['name']); -$people[0]['name'] = 'FooBar'; -var_dump($people[0]['name']); -$people[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people[0]['name']); -$people[0]['name'] .= 'Baz'; -var_dump($people[0]['name']); - -?> -===DONE=== ---EXPECTF-- -string(3) "Foo" -string(6) "FooBar" -string(9) "FooBarBaz" -===ArrayOverloading=== -string(3) "Foo" - -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_008.php on line %d diff --git a/tests/classes/array_access_009.phpt b/tests/classes/array_access_009.phpt deleted file mode 100755 index 32573f5a4d..0000000000 --- a/tests/classes/array_access_009.phpt +++ /dev/null @@ -1,190 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and ArrayProxyAccess, ArrayProxy ---FILE-- -<?php - -// NOTE: This will become part of SPL - -interface ArrayProxyAccess extends ArrayAccess -{ - 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); - } -} - -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]); - } -} - -$people = new Peoples; - -var_dump($people->person[0]['name']); -$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people->person[0]['name']); -$people->person[0]['name'] .= 'Baz'; -var_dump($people->person[0]['name']); - -echo "===ArrayOverloading===\n"; - -$people = new Peoples; - -var_dump($people[0]); -var_dump($people[0]['name']); -$people[0]['name'] = 'FooBar'; -var_dump($people[0]['name']); -$people[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people[0]['name']); -$people[0]['name'] .= 'Baz'; -var_dump($people[0]['name']); -unset($people[0]['name']); -var_dump($people[0]); -var_dump($people[0]['name']); -$people[0]['name'] = 'BlaBla'; -var_dump($people[0]['name']); - -?> -===DONE=== ---EXPECTF-- -string(3) "Foo" -string(6) "FooBar" -string(9) "FooBarBaz" -===ArrayOverloading=== -ArrayProxy::__construct(0) -object(ArrayProxy)#1 (2) { - ["object:private"]=> - object(Peoples)#2 (1) { - ["person"]=> - array(1) { - [0]=> - array(1) { - ["name"]=> - string(3) "Foo" - } - } - } - ["element:private"]=> - int(0) -} -ArrayProxy::__construct(0) -ArrayProxy::offsetGet(0, name) -string(3) "Foo" -ArrayProxy::__construct(0) -ArrayProxy::offsetSet(0, name, FooBar) -ArrayProxy::__construct(0) -ArrayProxy::offsetGet(0, name) -string(6) "FooBar" -ArrayProxy::__construct(0) -ArrayProxy::offsetSet(0, name, FooBarBar) -ArrayProxy::__construct(0) -ArrayProxy::offsetGet(0, name) -string(9) "FooBarBar" -ArrayProxy::__construct(0) -ArrayProxy::offsetGet(0, name) -ArrayProxy::offsetSet(0, name, FooBarBarBaz) -ArrayProxy::__construct(0) -ArrayProxy::offsetGet(0, name) -string(12) "FooBarBarBaz" -ArrayProxy::__construct(0) -ArrayProxy::offsetUnset(0, name) -ArrayProxy::__construct(0) -object(ArrayProxy)#1 (2) { - ["object:private"]=> - object(Peoples)#2 (1) { - ["person"]=> - array(1) { - [0]=> - array(0) { - } - } - } - ["element:private"]=> - int(0) -} -ArrayProxy::__construct(0) -ArrayProxy::offsetGet(0, name) -NULL -ArrayProxy::__construct(0) -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 deleted file mode 100755 index 05a169b2f0..0000000000 --- a/tests/classes/array_access_010.phpt +++ /dev/null @@ -1,168 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and ArrayReferenceProxy with references ---FILE-- -<?php - -// NOTE: This will become part of SPL - -class ArrayReferenceProxy implements ArrayAccess -{ - private $object; - private $element; - - function __construct(ArrayAccess $object, array &$element) - { - echo __METHOD__ . "($element)\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__ . "($this->element, $index)\n"; - return isset($this->element[$index]) ? $this->element[$index] : NULL; - } - - function offsetSet($index, $value) { - echo __METHOD__ . "($this->element, $index, $value)\n"; - $this->element[$index] = $value; - } - - function offsetUnset($index) { - echo __METHOD__ . "($this->element, $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]); - } -} - -$people = new Peoples; - -var_dump($people->person[0]['name']); -$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people->person[0]['name']); -$people->person[0]['name'] .= 'Baz'; -var_dump($people->person[0]['name']); - -echo "===ArrayOverloading===\n"; - -$people = new Peoples; - -var_dump($people[0]); -var_dump($people[0]['name']); -$people[0]['name'] = 'FooBar'; -var_dump($people[0]['name']); -$people[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people[0]['name']); -$people[0]['name'] .= 'Baz'; -var_dump($people[0]['name']); -unset($people[0]['name']); -var_dump($people[0]); -var_dump($people[0]['name']); -$people[0]['name'] = 'BlaBla'; -var_dump($people[0]['name']); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -string(3) "Foo" -string(6) "FooBar" -string(9) "FooBarBaz" -===ArrayOverloading=== -ArrayReferenceProxy::__construct(Array) -object(ArrayReferenceProxy)#1 (2) { - ["object:private"]=> - object(Peoples)#2 (1) { - ["person"]=> - array(1) { - [0]=> - &array(1) { - ["name"]=> - string(3) "Foo" - } - } - } - ["element:private"]=> - &array(1) { - ["name"]=> - string(3) "Foo" - } -} -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetGet(Array, name) -string(3) "Foo" -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetSet(Array, name, FooBar) -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetGet(Array, name) -string(6) "FooBar" -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetSet(Array, name, FooBarBar) -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetGet(Array, name) -string(9) "FooBarBar" -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetGet(Array, name) -ArrayReferenceProxy::offsetSet(Array, name, FooBarBarBaz) -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetGet(Array, name) -string(12) "FooBarBarBaz" -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetUnset(Array, name) -ArrayReferenceProxy::__construct(Array) -object(ArrayReferenceProxy)#1 (2) { - ["object:private"]=> - object(Peoples)#2 (1) { - ["person"]=> - array(1) { - [0]=> - &array(0) { - } - } - } - ["element:private"]=> - &array(0) { - } -} -ArrayReferenceProxy::__construct(Array) -ArrayReferenceProxy::offsetGet(Array, name) -NULL -ArrayReferenceProxy::__construct(Array) -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 deleted file mode 100755 index 20d39568ba..0000000000 --- a/tests/classes/array_access_011.phpt +++ /dev/null @@ -1,187 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and ArrayAccessReferenceProxy with references to main array ---FILE-- -<?php - -// NOTE: This will become part of SPL - -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]); - } -} - -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]); - } -} - -$people = new Peoples; - -var_dump($people->person[0]['name']); -$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people->person[0]['name']); -$people->person[0]['name'] .= 'Baz'; -var_dump($people->person[0]['name']); - -echo "===ArrayOverloading===\n"; - -$people = new Peoples; - -var_dump($people[0]); -var_dump($people[0]['name']); -$people[0]['name'] = 'FooBar'; -var_dump($people[0]['name']); -$people[0]['name'] = $people->person[0]['name'] . 'Bar'; -var_dump($people[0]['name']); -$people[0]['name'] .= 'Baz'; -var_dump($people[0]['name']); -unset($people[0]['name']); -var_dump($people[0]); -var_dump($people[0]['name']); -$people[0]['name'] = 'BlaBla'; -var_dump($people[0]['name']); - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -string(3) "Foo" -string(6) "FooBar" -string(9) "FooBarBaz" -===ArrayOverloading=== -ArrayAccessReferenceProxy::__construct(0) -object(ArrayAccessReferenceProxy)#1 (3) { - ["object:private"]=> - object(Peoples)#2 (1) { - ["person"]=> - &array(1) { - [0]=> - array(1) { - ["name"]=> - string(3) "Foo" - } - } - } - ["oarray:private"]=> - &array(1) { - [0]=> - array(1) { - ["name"]=> - string(3) "Foo" - } - } - ["element:private"]=> - int(0) -} -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetGet(0, name) -string(3) "Foo" -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetSet(0, name, FooBar) -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetGet(0, name) -string(6) "FooBar" -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetSet(0, name, FooBarBar) -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetGet(0, name) -string(9) "FooBarBar" -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetGet(0, name) -ArrayAccessReferenceProxy::offsetSet(0, name, FooBarBarBaz) -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetGet(0, name) -string(12) "FooBarBarBaz" -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetUnset(0, name) -ArrayAccessReferenceProxy::__construct(0) -object(ArrayAccessReferenceProxy)#1 (3) { - ["object:private"]=> - object(Peoples)#2 (1) { - ["person"]=> - &array(1) { - [0]=> - array(0) { - } - } - } - ["oarray:private"]=> - &array(1) { - [0]=> - array(0) { - } - } - ["element:private"]=> - int(0) -} -ArrayAccessReferenceProxy::__construct(0) -ArrayAccessReferenceProxy::offsetGet(0, name) -NULL -ArrayAccessReferenceProxy::__construct(0) -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 deleted file mode 100755 index d7503ec05c..0000000000 --- a/tests/classes/array_access_012.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -ZE2 ArrayAccess cannot assign by reference ---FILE-- -<?php - -class ArrayAccessImpl implements ArrayAccess { - private $data = array(); - - public function offsetUnset($index) {} - - public function offsetSet($index, $value) { - $this->data[$index] = $value; - } - - public function offsetGet($index) { - return $this->data[$index]; - } - - public function offsetExists($index) { - return isset($this->data[$index]); - } -} - -$data = new ArrayAccessImpl(); -$test = 'some data'; -$data['element'] = NULL; // prevent notice -$data['element'] = &$test; - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- - -Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_012.php on line %d diff --git a/tests/classes/array_access_013.phpt b/tests/classes/array_access_013.phpt deleted file mode 100755 index 206d9d5403..0000000000 --- a/tests/classes/array_access_013.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -ZE2 ArrayAccess and exceptions ---FILE-- -<?php - -class Test implements ArrayAccess -{ - public function offsetExists($offset) { throw new Exception(__METHOD__); return false; } - public function offsetGet($offset) { throw new Exception(__METHOD__); return $offset; } - public function offsetSet($offset, $data ) { throw new Exception(__METHOD__); } - public function offsetUnset($offset) { throw new Exception(__METHOD__); } -} - -$t = new Test; - -try -{ - echo isset($t[0]); -} -catch(Exception $e) -{ - echo "Caught in " . $e->getMessage() . "()\n"; -} - -try -{ - echo $t[0]; -} -catch(Exception $e) -{ - echo "Caught in " . $e->getMessage() . "()\n"; -} - -try -{ - $t[0] = 1; -} -catch(Exception $e) -{ - echo "Caught in " . $e->getMessage() . "()\n"; -} - -try -{ - 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/assign_op_property_001.phpt b/tests/classes/assign_op_property_001.phpt deleted file mode 100644 index 54e519e8f6..0000000000 --- a/tests/classes/assign_op_property_001.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 assign_op property of overloaded object ---FILE-- -<?php - -class Test { - private $real_a = 2; - - function __set($property, $value) { - if ($property = "a") { - $this->real_a = $value; - } - } - - function __get($property) { - if ($property = "a") { - return $this->real_a; - } - } -} - -$obj = new Test; -var_dump($obj->a); -$obj->a += 2; -var_dump($obj->a); -echo "---Done---\n"; -?> ---EXPECT-- -int(2) -int(4) ----Done--- diff --git a/tests/classes/autoload_001.phpt b/tests/classes/autoload_001.phpt deleted file mode 100755 index 6f325f49bb..0000000000 --- a/tests/classes/autoload_001.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -ZE2 Autoload and class_exists ---SKIPIF-- -<?php - if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); - if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already'); -?> ---FILE-- -<?php - -function __autoload($class_name) -{ - require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); - echo __FUNCTION__ . '(' . $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 deleted file mode 100755 index 27dea0f9d4..0000000000 --- a/tests/classes/autoload_002.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ZE2 Autoload and get_class_methods ---SKIPIF-- -<?php - if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); - if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already'); -?> ---FILE-- -<?php - -function __autoload($class_name) -{ - require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); - echo __FUNCTION__ . '(' . $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 deleted file mode 100755 index 7bdb5da36a..0000000000 --- a/tests/classes/autoload_003.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -ZE2 Autoload and derived classes ---SKIPIF-- -<?php - if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); - if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already'); -?> ---FILE-- -<?php - -function __autoload($class_name) -{ - require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); - echo __FUNCTION__ . '(' . $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 deleted file mode 100755 index 23aea5d086..0000000000 --- a/tests/classes/autoload_004.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -ZE2 Autoload and recursion ---SKIPIF-- -<?php - if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); - if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already'); -?> ---FILE-- -<?php - -function __autoload($class_name) -{ - var_dump(class_exists($class_name)); - require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); - echo __FUNCTION__ . '(' . $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 deleted file mode 100755 index 36a4e18f0b..0000000000 --- a/tests/classes/autoload_005.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -ZE2 Autoload from destructor ---SKIPIF-- -<?php - if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); - if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already'); -?> ---FILE-- -<?php - -function __autoload($class_name) -{ - var_dump(class_exists($class_name, false)); - require_once(dirname(__FILE__) . '/' . $class_name . '.p5c'); - echo __FUNCTION__ . '(' . $class_name . ")\n"; -} - -var_dump(class_exists('autoload_derived', false)); -var_dump(class_exists('autoload_derived', false)); - -class Test -{ - function __destruct() { - echo __METHOD__ . "\n"; - $o = new autoload_derived; - var_dump($o); - } -} - -$o = new Test; -unset($o); - -?> -===DONE=== ---EXPECTF-- -bool(false) -bool(false) -Test::__destruct -bool(false) -bool(false) -__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 deleted file mode 100755 index 9af6fc9829..0000000000 --- a/tests/classes/autoload_006.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -ZE2 Autoload from destructor ---SKIPIF-- -<?php - if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); - if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already'); -?> ---FILE-- -<?php - -function __autoload($class_name) -{ - require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c'); - echo __FUNCTION__ . '(' . $class_name . ")\n"; -} - -var_dump(interface_exists('autoload_interface', false)); -var_dump(class_exists('autoload_implements', false)); - -$o = new Autoload_Implements; -var_dump($o); -var_dump($o instanceof autoload_interface); -unset($o); - -var_dump(interface_exists('autoload_interface', false)); -var_dump(class_exists('autoload_implements', false)); - -?> -===DONE=== ---EXPECTF-- -bool(false) -bool(false) -__autoload(autoload_interface) -__autoload(Autoload_Implements) -object(autoload_implements)#%d (0) { -} -bool(true) -bool(true) -bool(true) -===DONE=== diff --git a/tests/classes/autoload_derived.p5c b/tests/classes/autoload_derived.p5c deleted file mode 100755 index 93a4b3579a..0000000000 --- a/tests/classes/autoload_derived.p5c +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class autoload_derived extends autoload_root { -} - -?>
\ No newline at end of file diff --git a/tests/classes/autoload_implements.p5c b/tests/classes/autoload_implements.p5c deleted file mode 100755 index 2c3479c860..0000000000 --- a/tests/classes/autoload_implements.p5c +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -class autoload_implements implements autoload_interface { - function testFunction() - { - return true; - } -} - -?>
\ No newline at end of file diff --git a/tests/classes/autoload_interface.p5c b/tests/classes/autoload_interface.p5c deleted file mode 100755 index 6908155e61..0000000000 --- a/tests/classes/autoload_interface.p5c +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -interface autoload_interface { - function testFunction(); -} - -?>
\ No newline at end of file diff --git a/tests/classes/autoload_root.p5c b/tests/classes/autoload_root.p5c deleted file mode 100755 index 9559d36d32..0000000000 --- a/tests/classes/autoload_root.p5c +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -class autoload_root { - function testFunction() - { - return true; - } -} - -?>
\ No newline at end of file diff --git a/tests/classes/bug23951.phpt b/tests/classes/bug23951.phpt deleted file mode 100644 index 2e272b87fe..0000000000 --- a/tests/classes/bug23951.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -Bug #23951 (Defines not working in inherited classes) ---FILE-- -<?php - -define('FOO1', 1); -define('FOO2', 2); - -class A { - - public $a_var = array(FOO1=>'foo1_value', FOO2=>'foo2_value'); - -} - -class B extends A { - - public $b_var = 'foo'; - -} - -$a = new A; -$b = new B; - -print_r($a); -print_r($b->a_var); -print_r($b->b_var); - -?> ---EXPECT-- -A Object -( - [a_var] => Array - ( - [1] => foo1_value - [2] => foo2_value - ) - -) -Array -( - [1] => foo1_value - [2] => foo2_value -) -foo diff --git a/tests/classes/bug24399.phpt b/tests/classes/bug24399.phpt deleted file mode 100644 index fedf8e5d24..0000000000 --- a/tests/classes/bug24399.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Bug #24399 (is_subclass_of() crashes when parent class doesn't exist) ---FILE-- -<?php -class dooh { - public $blah; -} -$d = new dooh; -var_dump(is_subclass_of($d, 'dooh')); -?> ---EXPECT-- -bool(false) diff --git a/tests/classes/bug24445.phpt b/tests/classes/bug24445.phpt deleted file mode 100644 index af08307ac4..0000000000 --- a/tests/classes/bug24445.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Bug #24445 (get_parent_class() returns the current class when passed an object) ---FILE-- -<?php -class Test { } -var_dump(get_parent_class('Test')); -$t = new Test; -var_dump(get_parent_class($t)); -?> ---EXPECT-- -bool(false) -bool(false) diff --git a/tests/classes/bug26737.phpt b/tests/classes/bug26737.phpt deleted file mode 100644 index e190318ffd..0000000000 --- a/tests/classes/bug26737.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #26737 (Protected and private variables are not saved on serialization when a user defined __sleep is used) ---FILE-- -<?php -class foo -{ - private $private = 'private'; - protected $protected = 'protected'; - public $public = 'public'; - - public function __sleep() - { - return array('private', 'protected', 'public', 'no_such'); - } -} -$foo = new foo(); -$data = serialize($foo); -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;}" diff --git a/tests/classes/bug27468.phpt b/tests/classes/bug27468.phpt deleted file mode 100644 index 971273224d..0000000000 --- a/tests/classes/bug27468.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #27468 (foreach in __destruct() causes segfault) ---FILE-- -<?php -class foo { - function __destruct() { - foreach ($this->x as $x); - } -} -new foo(); -echo 'OK'; -?> ---EXPECTF-- -Warning: Invalid argument supplied for foreach() in %sbug27468.php on line 4 -OK diff --git a/tests/classes/bug27504.phpt b/tests/classes/bug27504.phpt deleted file mode 100644 index ca13990c93..0000000000 --- a/tests/classes/bug27504.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -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"; - } - } - - $foo = new foo(); - - call_user_func_array( array( $foo , 'bar' ) , array( '2' ) ); - - $foo->bar('3'); -?> ---EXPECTF-- -Called function foo:bar(%d) - -Warning: call_user_func_array(): First argument is expected to be a valid callback, 'foo::bar' was given in %sbug27504.php on line %d - -Fatal error: Call to private method foo::bar() from context '' in %s on line %d diff --git a/tests/classes/bug29446.phpt b/tests/classes/bug29446.phpt deleted file mode 100644 index 5e30e8e74b..0000000000 --- a/tests/classes/bug29446.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Bug #29446 (ZE allows multiple declarations of the same class constant) ---FILE-- -<?php - -class testClass { - const TEST_CONST = 'test'; - const TEST_CONST = 'test1'; - - function testClass() { - echo self::TEST_CONST; - } -} - -$test = new testClass; - -?> ---EXPECTF-- -Fatal error: Cannot redefine class constant testClass::TEST_CONST in %s on line 5
\ No newline at end of file diff --git a/tests/classes/class_abstract.phpt b/tests/classes/class_abstract.phpt deleted file mode 100755 index 880f84930f..0000000000 --- a/tests/classes/class_abstract.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -ZE2 An abstract class cannot be instanciated ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -abstract class base { - function show() { - echo "base\n"; - } -} - -class derived extends base { -} - -$t = new derived(); -$t->show(); - -$t = new base(); -$t->show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -base - -Fatal error: Cannot instantiate abstract class base in %s on line %d diff --git a/tests/classes/class_example.phpt b/tests/classes/class_example.phpt deleted file mode 100644 index 621958b1bd..0000000000 --- a/tests/classes/class_example.phpt +++ /dev/null @@ -1,85 +0,0 @@ ---TEST-- -Classes general test ---FILE-- - -<?php - -/* pretty nifty object oriented code! */ - -class user { - public $first_name,$family_name,$address,$phone_num; - function display() - { - echo "User information\n"; - echo "----------------\n\n"; - echo "First name:\t ".$this->first_name."\n"; - echo "Family name:\t ".$this->family_name."\n"; - echo "Address:\t ".$this->address."\n"; - echo "Phone:\t\t ".$this->phone_num."\n"; - echo "\n\n"; - } - function initialize($first_name,$family_name,$address,$phone_num) - { - $this->first_name = $first_name; - $this->family_name = $family_name; - $this->address = $address; - $this->phone_num = $phone_num; - } -}; - - -function test($u) -{ /* one can pass classes as arguments */ - $u->display(); - $t = $u; - $t->address = "New address..."; - return $t; /* and also return them as return values */ -} - -$user1 = new user; -$user2 = new user; - -$user1->initialize("Zeev","Suraski","Ben Gourion 3, Kiryat Bialik, Israel","+972-4-8713139"); -$user2->initialize("Andi","Gutmans","Haifa, Israel","+972-4-8231621"); -$user1->display(); -$user2->display(); - -$tmp = test($user2); -$tmp->display(); - -?> ---EXPECT-- -User information ----------------- - -First name: Zeev -Family name: Suraski -Address: Ben Gourion 3, Kiryat Bialik, Israel -Phone: +972-4-8713139 - - -User information ----------------- - -First name: Andi -Family name: Gutmans -Address: Haifa, Israel -Phone: +972-4-8231621 - - -User information ----------------- - -First name: Andi -Family name: Gutmans -Address: Haifa, Israel -Phone: +972-4-8231621 - - -User information ----------------- - -First name: Andi -Family name: Gutmans -Address: New address... -Phone: +972-4-8231621 diff --git a/tests/classes/class_final.phpt b/tests/classes/class_final.phpt deleted file mode 100755 index 5c73cb2556..0000000000 --- a/tests/classes/class_final.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -ZE2 A final class cannot be inherited ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -final class base { - function show() { - echo "base\n"; - } -} - -$t = new base(); - -class derived extends base { -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Class derived may not inherit from final class (base) in %s on line %d diff --git a/tests/classes/class_stdclass.phpt b/tests/classes/class_stdclass.phpt deleted file mode 100755 index 5e3422aeae..0000000000 --- a/tests/classes/class_stdclass.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Instantiate stdClass ---FILE-- -<?php - -$obj = new stdClass; - -echo get_class($obj)."\n"; - -echo "Done\n"; -?> ---EXPECTF-- -stdClass -Done diff --git a/tests/classes/clone_001.phpt b/tests/classes/clone_001.phpt deleted file mode 100755 index eb06c1f520..0000000000 --- a/tests/classes/clone_001.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -ZE2 object cloning, 1 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - public $p1 = 1; - public $p2 = 2; - public $p3; -}; - -$obj = new test; -$obj->p2 = 'A'; -$obj->p3 = 'B'; -$copy = clone $obj; -$copy->p3 = 'C'; -echo "Object\n"; -var_dump($obj); -echo "Clown\n"; -var_dump($copy); -echo "Done\n"; -?> ---EXPECT-- -Object -object(test)#1 (3) { - ["p1"]=> - int(1) - ["p2"]=> - string(1) "A" - ["p3"]=> - string(1) "B" -} -Clown -object(test)#2 (3) { - ["p1"]=> - int(1) - ["p2"]=> - string(1) "A" - ["p3"]=> - string(1) "C" -} -Done diff --git a/tests/classes/clone_002.phpt b/tests/classes/clone_002.phpt deleted file mode 100755 index 4430a2cab4..0000000000 --- a/tests/classes/clone_002.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -ZE2 object cloning, 2 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - public $p1 = 1; - public $p2 = 2; - public $p3; - public function __clone() { - } -}; - -$obj = new test; -$obj->p2 = 'A'; -$obj->p3 = 'B'; -$copy = clone $obj; -$copy->p3 = 'C'; -echo "Object\n"; -var_dump($obj); -echo "Clown\n"; -var_dump($copy); -echo "Done\n"; -?> ---EXPECT-- -Object -object(test)#1 (3) { - ["p1"]=> - int(1) - ["p2"]=> - string(1) "A" - ["p3"]=> - string(1) "B" -} -Clown -object(test)#2 (3) { - ["p1"]=> - int(1) - ["p2"]=> - string(1) "A" - ["p3"]=> - string(1) "C" -} -Done diff --git a/tests/classes/clone_003.phpt b/tests/classes/clone_003.phpt deleted file mode 100755 index 658810825c..0000000000 --- a/tests/classes/clone_003.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -ZE2 object cloning, 3 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---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() { - } -}; - -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'; - } -} - -$obj = new test; -$obj->p4 = 'A'; -$copy = clone $obj; -echo "Object\n"; -print_r($obj); -echo "Clown\n"; -print_r($copy); -echo "Done\n"; -?> ---EXPECT-- -Object -test Object -( - [p1] => test:1 - [p3] => test:3 - [p4] => A - [p5] => test:5 - [p2] => base:2 - [p6:private] => base:6 -) -Clown -test Object -( - [p1] => test:1 - [p3] => test:3 - [p4] => A - [p5] => clone:5 - [p2] => base:2 - [p6:private] => base:6 -) -Done diff --git a/tests/classes/clone_004.phpt b/tests/classes/clone_004.phpt deleted file mode 100755 index 2059103bc5..0000000000 --- a/tests/classes/clone_004.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -ZE2 object cloning, 4 ---FILE-- -<?php -abstract class base { - public $a = 'base'; - - // disallow cloning - private function __clone() {} -} - -class test extends base { - public $b = 'test'; - - // reenable cloning - public function __clone() {} - - public function show() { - var_dump($this); - } -} - -echo "Original\n"; -$o1 = new test; -$o1->a = array(1,2); -$o1->b = array(3,4); -$o1->show(); - -echo "Clone\n"; -$o2 = clone $o1; -$o2->show(); - -echo "Modify\n"; -$o2->a = 5; -$o2->b = 6; -$o2->show(); - -echo "Done\n"; -?> ---EXPECT-- -Original -object(test)#1 (2) { - ["b"]=> - array(2) { - [0]=> - int(3) - [1]=> - int(4) - } - ["a"]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} -Clone -object(test)#2 (2) { - ["b"]=> - array(2) { - [0]=> - int(3) - [1]=> - int(4) - } - ["a"]=> - array(2) { - [0]=> - int(1) - [1]=> - int(2) - } -} -Modify -object(test)#2 (2) { - ["b"]=> - int(6) - ["a"]=> - int(5) -} -Done diff --git a/tests/classes/clone_005.phpt b/tests/classes/clone_005.phpt deleted file mode 100755 index bfe4d66d6f..0000000000 --- a/tests/classes/clone_005.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -ZE2 object cloning, 5 ---FILE-- -<?php -abstract class base { - public $a = 'base'; - - // disallow cloning once forever - final private function __clone() {} -} - -class test extends base { - // reenabling should fail - public function __clone() {} -} - -?> ---EXPECTF-- -Fatal error: Cannot override final method base::__clone() in %sclone_005.php on line %d diff --git a/tests/classes/clone_006.phpt b/tests/classes/clone_006.phpt deleted file mode 100755 index de22fec151..0000000000 --- a/tests/classes/clone_006.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -ZE2 object cloning, 6 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---INI-- -error_reporting=2047 ---FILE-- -<?php - -class MyCloneable { - static $id = 0; - - function MyCloneable() { - $this->id = self::$id++; - } - - function __clone() { - $this->address = "New York"; - $this->id = self::$id++; - } -} - -$original = new MyCloneable(); - -$original->name = "Hello"; -$original->address = "Tel-Aviv"; - -echo $original->id . "\n"; - -$clone = clone $original; - -echo $clone->id . "\n"; -echo $clone->name . "\n"; -echo $clone->address . "\n"; - -?> ---EXPECT-- -0 -1 -Hello -New York diff --git a/tests/classes/constants_scope_001.phpt b/tests/classes/constants_scope_001.phpt deleted file mode 100644 index 50066282ea..0000000000 --- a/tests/classes/constants_scope_001.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -ZE2 class constants and scope ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class ErrorCodes { - 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; - } -} - -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; - } -} - -/* Call the static function and move into the ErrorCodes scope */ -ErrorCodes::print_fatal_error_codes(); -ErrorCodesDerived::print_fatal_error_codes(); - -?> ---EXPECTF-- - -Notice: Use of undefined constant FATAL - assumed 'FATAL' in %sconstants_scope_001.php on line %d -FATAL = FATAL -self::FATAL = Fatal error -self::FATAL = Worst error -parent::FATAL = Fatal error diff --git a/tests/classes/ctor_dtor.phpt b/tests/classes/ctor_dtor.phpt deleted file mode 100644 index ea6813cc96..0000000000 --- a/tests/classes/ctor_dtor.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -ZE2 The new constructor/destructor is called ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class early { - function early() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } -} - -class late { - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - } -} - -$t = new early(); -$t->early(); -unset($t); -$t = new late(); -//unset($t); delay to end of script - -echo "Done\n"; -?> ---EXPECTF-- -early::early -early::early -early::__destruct -late::__construct -Done -late::__destruct diff --git a/tests/classes/ctor_dtor_inheritance.phpt b/tests/classes/ctor_dtor_inheritance.phpt deleted file mode 100644 index 8ae2a5dec4..0000000000 --- a/tests/classes/ctor_dtor_inheritance.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -ZE2 A derived class can use the inherited constructor/destructor ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -// This test checks for: -// - inherited constructors/destructors are not called automatically -// - base classes know about derived properties in constructor/destructor -// - base class constructors/destructors know the instanciated class name - -class base { - public $name; - - function __construct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - $this->name = 'base'; - print_r($this); - } - - function __destruct() { - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - print_r($this); - } -} - -class derived extends base { - 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 __destruct() { - parent::__destruct(); - echo __CLASS__ . "::" . __FUNCTION__ . "\n"; - print_r($this); - } -} - -echo "Testing class base\n"; -$t = new base(); -unset($t); -echo "Testing class derived\n"; -$t = new derived(); -unset($t); - -echo "Done\n"; -?> ---EXPECTF-- -Testing class base -base::__construct -base Object -( - [name] => base -) -base::__destruct -base Object -( - [name] => base -) -Testing class derived -derived Object -( - [other] => other - [name] => init -) -base::__construct -derived Object -( - [other] => other - [name] => base -) -derived::__construct -derived Object -( - [other] => other - [name] => derived -) -base::__destruct -derived Object -( - [other] => other - [name] => derived -) -derived::__destruct -derived Object -( - [other] => other - [name] => derived -) -Done diff --git a/tests/classes/ctor_failure.phpt b/tests/classes/ctor_failure.phpt deleted file mode 100755 index b7d3b64dda..0000000000 --- a/tests/classes/ctor_failure.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 Do not call destructors if constructor fails ---FILE-- -<?php - -class Test -{ - function __construct($msg) { - echo __METHOD__ . "($msg)\n"; - throw new Exception($msg); - } - - function __destruct() { - echo __METHOD__ . "\n"; - } -} - -try -{ - $o = new Test('Hello'); - unset($o); -} -catch (Exception $e) -{ - echo 'Caught ' . get_class($e) . '(' . $e->getMessage() . ")\n"; -} - -?> -===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 deleted file mode 100755 index f6f9b66eab..0000000000 --- a/tests/classes/ctor_in_interface_01.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -ZE2 A class constructor must keep the signature of an interface ---FILE-- -<?php -interface constr -{ - function __construct(); -} - -class implem implements constr -{ - function __construct($a) - { - } -} - -?> ---EXPECTF-- -Fatal error: Declaration of implem::__construct() must be compatible with that of constr::__construct() in %s on line %d diff --git a/tests/classes/ctor_in_interface_02.phpt b/tests/classes/ctor_in_interface_02.phpt deleted file mode 100755 index a0dfe87788..0000000000 --- a/tests/classes/ctor_in_interface_02.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ZE2 A class constructor must keep the signature of all interfaces ---FILE-- -<?php -interface constr1 -{ - function __construct(); -} - -interface constr2 extends constr1 -{ -} - -class implem12 implements constr2 -{ - function __construct() - { - } -} - -interface constr3 -{ - function __construct($a); -} - -class implem13 implements constr1, constr3 -{ - function __construct() - { - } -} - -?> ---EXPECTF-- -Fatal error: Can't inherit abstract function constr3::__construct() (previously declared abstract in constr1) in %s on line %d diff --git a/tests/classes/ctor_in_interface_03.phpt b/tests/classes/ctor_in_interface_03.phpt deleted file mode 100755 index 953d6822fd..0000000000 --- a/tests/classes/ctor_in_interface_03.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ZE2 A class constructor must keep the signature of base class interfaces ---FILE-- -<?php -interface constr -{ - function __construct(); -} - -abstract class implem implements constr -{ -} - -class derived extends implem -{ - function __construct($a) - { - } -} - -?> ---EXPECTF-- -Fatal error: Declaration of derived::__construct() must be compatible with that of constr::__construct() in %s on line %d diff --git a/tests/classes/ctor_in_interface_04.phpt b/tests/classes/ctor_in_interface_04.phpt deleted file mode 100755 index 0016244c18..0000000000 --- a/tests/classes/ctor_in_interface_04.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 A class constructor must keep the signature of base class interfaces ---FILE-- -<?php -interface constr -{ - function __construct(); -} - -class implem implements constr -{ - function __construct() - { - } -} - -class derived extends implem -{ - function __construct($a) - { - } -} - -?> ---EXPECTF-- -Fatal error: Declaration of derived::__construct() must be compatible with that of constr::__construct() in %s on line %d diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt deleted file mode 100644 index 1a1d6fa511..0000000000 --- a/tests/classes/ctor_name_clash.phpt +++ /dev/null @@ -1,22 +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-- -base::base -derived::base diff --git a/tests/classes/ctor_visibility.phpt b/tests/classes/ctor_visibility.phpt deleted file mode 100755 index 8d3b1c5c50..0000000000 --- a/tests/classes/ctor_visibility.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -ZE2 A private constructor cannot be called ---FILE-- -<?php - -class Test -{ - function __construct() - { - echo __METHOD__ . "()\n"; - } -} - -class Derived extends Test -{ - function __construct() - { - echo __METHOD__ . "()\n"; - parent::__construct(); - } - - static function f() - { - new Derived; - } -} - -Derived::f(); - -class TestPriv -{ - private function __construct() - { - echo __METHOD__ . "()\n"; - } - - static function f() - { - new TestPriv; - } -} - -TestPriv::f(); - -class DerivedPriv extends TestPriv -{ - function __construct() - { - echo __METHOD__ . "()\n"; - parent::__construct(); - } - - static function f() - { - new DerivedPriv; - } -} - -DerivedPriv::f(); - -?> -===DONE=== ---EXPECTF-- -Derived::__construct() -Test::__construct() -TestPriv::__construct() -DerivedPriv::__construct() - -Fatal error: Cannot call private TestPriv::__construct() in %sctor_visibility.php on line %d diff --git a/tests/classes/dereferencing_001.phpt b/tests/classes/dereferencing_001.phpt deleted file mode 100644 index dd2aba78e5..0000000000 --- a/tests/classes/dereferencing_001.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ZE2 dereferencing of objects from methods ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Name { - function Name($_name) { - $this->name = $_name; - } - - function display() { - echo $this->name . "\n"; - } -} - -class Person { - private $name; - - function person($_name, $_address) { - $this->name = new Name($_name); - } - - function getName() { - return $this->name; - } -} - -$person = new Person("John", "New York"); -$person->getName()->display(); - -?> ---EXPECT-- -John diff --git a/tests/classes/destructor_and_echo.phpt b/tests/classes/destructor_and_echo.phpt deleted file mode 100755 index 0a253593a5..0000000000 --- a/tests/classes/destructor_and_echo.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -ZE2 Destructors and echo ---FILE-- -<?php - -class Test -{ - function __construct() { - echo __METHOD__ . "\n"; - } - - function __destruct() { - echo __METHOD__ . "\n"; - } -} - -$o = new Test; - -?> -===DONE=== ---EXPECT-- -Test::__construct -===DONE=== -Test::__destruct diff --git a/tests/classes/destructor_and_exceptions.phpt b/tests/classes/destructor_and_exceptions.phpt deleted file mode 100755 index 8100c92465..0000000000 --- a/tests/classes/destructor_and_exceptions.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -ZE2 catch exception thrown in destructor ---FILE-- -<?php - -class FailClass -{ - public $fatal; - - function __destruct() - { - echo __METHOD__ . "\n"; - throw new exception("FailClass"); - echo "Done: " . __METHOD__ . "\n"; - } -} - -try -{ - $a = new FailClass; - unset($a); -} -catch(Exception $e) -{ - echo "Caught: " . $e->getMessage() . "\n"; -} - -class FatalException extends Exception -{ - function __construct($what) - { - echo __METHOD__ . "\n"; - $o = new FailClass; - unset($o); - echo "Done: " . __METHOD__ . "\n"; - } -} - -try -{ - throw new FatalException("Damn"); -} -catch(Exception $e) -{ - echo "Caught Exception: " . $e->getMessage() . "\n"; -} -catch(FatalException $e) -{ - echo "Caught FatalException: " . $e->getMessage() . "\n"; -} - -?> -===DONE=== ---EXPECTF-- -FailClass::__destruct -Caught: FailClass -FatalException::__construct -FailClass::__destruct -Caught Exception: FailClass -===DONE=== diff --git a/tests/classes/destructor_and_globals.phpt b/tests/classes/destructor_and_globals.phpt deleted file mode 100755 index 9caf0f1026..0000000000 --- a/tests/classes/destructor_and_globals.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -ZE2 accessing globals from destructor in shutdown ---FILE-- -<?php -$test_cnt = 0; -$test_num = 0; - -function Show() { - global $test_cnt; - echo "Count: $test_cnt\n"; -} - -class counter { - protected $id; - - public function __construct() { - global $test_cnt, $test_num; - $test_cnt++; - $this->id = $test_num++; - } - - public function Show() { - echo 'Id: '.$this->id."\n"; - } - - // try protected here - public function __destruct() { - global $test_cnt; - $test_cnt--; - } - - static public function destroy(&$obj) { - $obj = NULL; - } -} -Show(); -$obj1 = new counter; -$obj1->Show(); -Show(); -$obj2 = new counter; -$obj2->Show(); -Show(); -counter::destroy($obj1); -Show(); -// or uncomment this line and it works -//counter::destroy($obj2); -echo "Done\n"; -?> ---EXPECT-- -Count: 0 -Id: 0 -Count: 1 -Id: 1 -Count: 2 -Count: 1 -Done diff --git a/tests/classes/destructor_and_references.phpt b/tests/classes/destructor_and_references.phpt deleted file mode 100755 index 6b9b019b62..0000000000 --- a/tests/classes/destructor_and_references.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 Destructing and references ---FILE-- -<?php - -class test1 {public $x;}; -class test2 {public $x;}; -class test3 {public $x;}; -class test4 {public $x;}; - -$o1 = new test1; -$o2 = new test2; -$o3 = new test3; -$o4 = new test4; - -$o3->x = &$o4; - -$r1 = &$o1; - -class once {} - -$o = new once; -echo "Done\n"; -?> ---EXPECT-- -Done diff --git a/tests/classes/destructor_inheritance.phpt b/tests/classes/destructor_inheritance.phpt deleted file mode 100755 index b9a46659b0..0000000000 --- a/tests/classes/destructor_inheritance.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -ZE2 The inherited destructor is called ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class base { - function __construct() { - echo __METHOD__ . "\n"; - } - - function __destruct() { - echo __METHOD__ . "\n"; - } -} - -class derived extends base { -} - -$obj = new derived; - -unset($obj); - -echo 'Done'; -?> ---EXPECT-- -base::__construct -base::__destruct -Done
\ No newline at end of file diff --git a/tests/classes/destructor_visibility_001.phpt b/tests/classes/destructor_visibility_001.phpt deleted file mode 100755 index 7674c512f6..0000000000 --- a/tests/classes/destructor_visibility_001.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -ZE2 Ensuring destructor visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } -} - -class Derived extends Base { -} - -$obj = new Derived; - -unset($obj); - -?> -===DONE=== ---EXPECTF-- -Fatal error: Call to private Derived::__destruct() from context '' in %sdestructor_visibility_001.php on line %d diff --git a/tests/classes/destructor_visibility_002.phpt b/tests/classes/destructor_visibility_002.phpt deleted file mode 100755 index 2cc83334a9..0000000000 --- a/tests/classes/destructor_visibility_002.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -ZE2 Ensuring destructor visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } -} - -class Derived extends Base { -} - -$obj = new Derived; - -?> -===DONE=== ---EXPECTF-- -===DONE=== - -Warning: Call to private Derived::__destruct() from context '' during shutdown ignored in Unknown on line %d diff --git a/tests/classes/destructor_visibility_003.phpt b/tests/classes/destructor_visibility_003.phpt deleted file mode 100755 index 83e3efe22e..0000000000 --- a/tests/classes/destructor_visibility_003.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -ZE2 Ensuring destructor visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Base { - private function __destruct() { - echo __METHOD__ . "\n"; - } -} - -class Derived extends Base { - public function __destruct() { - echo __METHOD__ . "\n"; - } -} - -$obj = new Derived; - -unset($obj); // Derived::__destruct is being called not Base::__destruct - -?> -===DONE=== ---EXPECTF-- -Derived::__destruct -===DONE=== diff --git a/tests/classes/factory_001.phpt b/tests/classes/factory_001.phpt deleted file mode 100644 index 97b69c1b47..0000000000 --- a/tests/classes/factory_001.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ZE2 factory objects ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Circle { - function draw() { - echo "Circle\n"; - } -} - -class Square { - function draw() { - print "Square\n"; - } -} - -function ShapeFactoryMethod($shape) { - switch ($shape) { - case "Circle": - return new Circle(); - case "Square": - return new Square(); - } -} - -ShapeFactoryMethod("Circle")->draw(); -ShapeFactoryMethod("Square")->draw(); - -?> ---EXPECT-- -Circle -Square diff --git a/tests/classes/factory_and_singleton_001.phpt b/tests/classes/factory_and_singleton_001.phpt deleted file mode 100755 index 70fa020a49..0000000000 --- a/tests/classes/factory_and_singleton_001.phpt +++ /dev/null @@ -1,101 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 1 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - protected $x; - - static private $test = NULL; - static private $cnt = 0; - - static function factory($x) { - if (test::$test) { - return test::$test; - } else { - test::$test = new test($x); - return test::$test; - } - } - - protected function __construct($x) { - test::$cnt++; - $this->x = $x; - } - - static function destroy() { - test::$test = NULL; - } - - protected function __destruct() { - test::$cnt--; - } - - public function get() { - return $this->x; - } - - static public function getX() { - if (test::$test) { - return test::$test->x; - } else { - return NULL; - } - } - - static public function count() { - return test::$cnt; - } -} - -echo "Access static members\n"; -var_dump(test::getX()); -var_dump(test::count()); - -echo "Create x and y\n"; -$x = test::factory(1); -$y = test::factory(2); -var_dump(test::getX()); -var_dump(test::count()); -var_dump($x->get()); -var_dump($y->get()); - -echo "Destruct x\n"; -$x = NULL; -var_dump(test::getX()); -var_dump(test::count()); -var_dump($y->get()); - -echo "Destruct y\n"; -$y = NULL; -var_dump(test::getX()); -var_dump(test::count()); - -echo "Destruct static\n"; -test::destroy(); -var_dump(test::getX()); -var_dump(test::count()); - -echo "Done\n"; -?> ---EXPECT-- -Access static members -NULL -int(0) -Create x and y -int(1) -int(1) -int(1) -int(1) -Destruct x -int(1) -int(1) -int(1) -Destruct y -int(1) -int(1) -Destruct static -NULL -int(0) -Done diff --git a/tests/classes/factory_and_singleton_002.phpt b/tests/classes/factory_and_singleton_002.phpt deleted file mode 100755 index 3308a561a5..0000000000 --- a/tests/classes/factory_and_singleton_002.phpt +++ /dev/null @@ -1,100 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 2 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - protected $x; - - static private $test = NULL; - static private $cnt = 0; - - static function factory($x) { - if (test::$test) { - return test::$test; - } else { - test::$test = new test($x); - return test::$test; - } - } - - protected function __construct($x) { - test::$cnt++; - $this->x = $x; - } - - static function destroy() { - test::$test = NULL; - } - - protected function __destruct() { - test::$cnt--; - } - - public function get() { - return $this->x; - } - - static public function getX() { - if (test::$test) { - return test::$test->x; - } else { - return NULL; - } - } - - static public function count() { - return test::$cnt; - } -} - -echo "Access static members\n"; -var_dump(test::getX()); -var_dump(test::count()); - -echo "Create x and y\n"; -$x = test::factory(1); -$y = test::factory(2); -var_dump(test::getX()); -var_dump(test::count()); -var_dump($x->get()); -var_dump($y->get()); - -echo "Destruct x\n"; -$x = NULL; -var_dump(test::getX()); -var_dump(test::count()); -var_dump($y->get()); - -echo "Destruct y\n"; -$y = NULL; -var_dump(test::getX()); -var_dump(test::count()); - -//echo "Destruct static\n"; -//test::destroy(); -//var_dump(test::getX()); -//var_dump(test::count()); - -echo "Done\n"; -?> ---EXPECT-- -Access static members -NULL -int(0) -Create x and y -int(1) -int(1) -int(1) -int(1) -Destruct x -int(1) -int(1) -int(1) -Destruct y -int(1) -int(1) -Done - -Warning: Call to protected test::__destruct() from context '' during shutdown ignored in Unknown on line 0 diff --git a/tests/classes/factory_and_singleton_003.phpt b/tests/classes/factory_and_singleton_003.phpt deleted file mode 100755 index 3d50a810a6..0000000000 --- a/tests/classes/factory_and_singleton_003.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 3 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - protected function __construct($x) { - } -} - -$obj = new test; - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Call to protected test::__construct() from invalid context in %s on line %d diff --git a/tests/classes/factory_and_singleton_004.phpt b/tests/classes/factory_and_singleton_004.phpt deleted file mode 100755 index 14edcb1fc8..0000000000 --- a/tests/classes/factory_and_singleton_004.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 4 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - private function __construct($x) { - } -} - -$obj = new test; - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Call to private test::__construct() from invalid context in %s on line %d diff --git a/tests/classes/factory_and_singleton_005.phpt b/tests/classes/factory_and_singleton_005.phpt deleted file mode 100755 index 2cd7e5cc99..0000000000 --- a/tests/classes/factory_and_singleton_005.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 5 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - protected function __destruct() { - } -} - -$obj = new test; -$obj = NULL; - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Call to protected test::__destruct() from context '' in %sfactory_and_singleton_005.php on line %d diff --git a/tests/classes/factory_and_singleton_006.phpt b/tests/classes/factory_and_singleton_006.phpt deleted file mode 100755 index 81cf714888..0000000000 --- a/tests/classes/factory_and_singleton_006.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 6 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - private function __destruct() { - } -} - -$obj = new test; -$obj = NULL; - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Call to private test::__destruct() from context '' in %sfactory_and_singleton_006.php on line %d - diff --git a/tests/classes/factory_and_singleton_007.phpt b/tests/classes/factory_and_singleton_007.phpt deleted file mode 100755 index 4788dbf087..0000000000 --- a/tests/classes/factory_and_singleton_007.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 7 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - protected function __clone() { - } -} - -$obj = new test; -$clone = clone $obj; -$obj = NULL; - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Call to protected test::__clone() from context '' %sfactory_and_singleton_007.php on line %d diff --git a/tests/classes/factory_and_singleton_008.phpt b/tests/classes/factory_and_singleton_008.phpt deleted file mode 100755 index 750b9db340..0000000000 --- a/tests/classes/factory_and_singleton_008.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 8 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - private function __clone() { - } -} - -$obj = new test; -$clone = clone $obj; -$obj = NULL; - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: Call to private test::__clone() from context '' %sfactory_and_singleton_008.php on line %d diff --git a/tests/classes/factory_and_singleton_009.phpt b/tests/classes/factory_and_singleton_009.phpt deleted file mode 100755 index acf792c316..0000000000 --- a/tests/classes/factory_and_singleton_009.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 9 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - protected function __destruct() { - echo __METHOD__ . "\n"; - } -} - -$obj = new test; - -?> -===DONE=== ---EXPECTF-- -===DONE=== - -Warning: Call to protected test::__destruct() from context '' during shutdown ignored in Unknown on line 0 diff --git a/tests/classes/factory_and_singleton_010.phpt b/tests/classes/factory_and_singleton_010.phpt deleted file mode 100755 index 0f5fb2dc74..0000000000 --- a/tests/classes/factory_and_singleton_010.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -ZE2 factory and singleton, test 10 ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class test { - - private function __destruct() { - echo __METHOD__ . "\n"; - } -} - -$obj = new test; - -?> -===DONE=== ---EXPECTF-- -===DONE=== - -Warning: Call to private test::__destruct() from context '' during shutdown ignored in Unknown on line 0 diff --git a/tests/classes/final.phpt b/tests/classes/final.phpt deleted file mode 100644 index b4e37a36f6..0000000000 --- a/tests/classes/final.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 A method may be redeclared final ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class first { - 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"; - } -} - -$t2 = new second(); -$t2->show(); - -echo "Done\n"; -?> ---EXPECTF-- -Call to function first::show() -Call to function second::show() -Done
\ No newline at end of file diff --git a/tests/classes/final_abstract.phpt b/tests/classes/final_abstract.phpt deleted file mode 100644 index 426c852cfc..0000000000 --- a/tests/classes/final_abstract.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -ZE2 A final method cannot be abstract ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class fail { - final abstract function show(); -} - -echo "Done\n"; // Shouldn't be displayed -?> ---EXPECTF-- - -Fatal error: Cannot use the final modifier on an abstract class member in %s diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt deleted file mode 100755 index ebfa08081e..0000000000 --- a/tests/classes/final_ctor1.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -ZE2 cannot override final __construct ---FILE-- -<?php - -class Base -{ - public final function __construct() - { - } -} - -class Works extends Base -{ -} - -class Extended extends Base -{ - public function Extended() - { - } -} - -ReflectionClass::export('Extended'); - -?> ---EXPECTF-- - -Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt deleted file mode 100755 index 905337b408..0000000000 --- a/tests/classes/final_ctor2.phpt +++ /dev/null @@ -1,29 +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-- - -Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d diff --git a/tests/classes/final_redeclare.phpt b/tests/classes/final_redeclare.phpt deleted file mode 100644 index e8f2e6ff09..0000000000 --- a/tests/classes/final_redeclare.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -ZE2 A final method may not be overwritten ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - 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"; - } -} - -echo "Done\n"; // Shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Cannot override final method pass::show() in %s on line %d diff --git a/tests/classes/incdec_property_001.phpt b/tests/classes/incdec_property_001.phpt deleted file mode 100644 index 39bf06f65f..0000000000 --- a/tests/classes/incdec_property_001.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 post increment/decrement property of overloaded object ---FILE-- -<?php - -class Test { - private $real_a = 2; - - function __set($property, $value) { - if ($property = "a") { - $this->real_a = $value; - } - } - - function __get($property) { - if ($property = "a") { - return $this->real_a; - } - } -} - -$obj = new Test; -var_dump($obj->a); -$obj->a++; -var_dump($obj->a); -echo "---Done---\n"; -?> ---EXPECT-- -int(2) -int(3) ----Done--- diff --git a/tests/classes/incdec_property_002.phpt b/tests/classes/incdec_property_002.phpt deleted file mode 100644 index fe08625ea8..0000000000 --- a/tests/classes/incdec_property_002.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 post increment/decrement property of overloaded object with assignment ---FILE-- -<?php - -class Test { - private $real_a = 2; - - function __set($property, $value) { - if ($property = "a") { - $this->real_a = $value; - } - } - - function __get($property) { - if ($property = "a") { - return $this->real_a; - } - } -} - -$obj = new Test; -var_dump($obj->a); -$t1 = $obj->a++; -var_dump($obj->a); -echo "---Done---\n"; -?> ---EXPECT-- -int(2) -int(3) ----Done--- diff --git a/tests/classes/incdec_property_003.phpt b/tests/classes/incdec_property_003.phpt deleted file mode 100644 index d26277ab8d..0000000000 --- a/tests/classes/incdec_property_003.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 pre increment/decrement property of overloaded object ---FILE-- -<?php - -class Test { - private $real_a = 2; - - function __set($property, $value) { - if ($property = "a") { - $this->real_a = $value; - } - } - - function __get($property) { - if ($property = "a") { - return $this->real_a; - } - } -} - -$obj = new Test; -var_dump($obj->a); -++$obj->a; -var_dump($obj->a); -echo "---Done---\n"; -?> ---EXPECT-- -int(2) -int(3) ----Done--- diff --git a/tests/classes/incdec_property_004.phpt b/tests/classes/incdec_property_004.phpt deleted file mode 100644 index 5ccad190b8..0000000000 --- a/tests/classes/incdec_property_004.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 pre increment/decrement property of overloaded object with assignment ---FILE-- -<?php - -class Test { - private $real_a = 2; - - function __set($property, $value) { - if ($property = "a") { - $this->real_a = $value; - } - } - - function __get($property) { - if ($property = "a") { - return $this->real_a; - } - } -} - -$obj = new Test; -var_dump($obj->a); -$t1 = ++$obj->a; -var_dump($obj->a); -echo "---Done---\n"; -?> ---EXPECT-- -int(2) -int(3) ----Done--- diff --git a/tests/classes/inheritance.phpt b/tests/classes/inheritance.phpt deleted file mode 100644 index 070ad9147d..0000000000 --- a/tests/classes/inheritance.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -Classes inheritance test ---FILE-- -<?php - -/* Inheritance test. Pretty nifty if I do say so myself! */ - -class foo { - public $a; - public $b; - function display() { - echo "This is class foo\n"; - echo "a = ".$this->a."\n"; - echo "b = ".$this->b."\n"; - } - function mul() { - return $this->a*$this->b; - } -}; - -class bar extends foo { - public $c; - function display() { /* alternative display function for class bar */ - echo "This is class bar\n"; - echo "a = ".$this->a."\n"; - echo "b = ".$this->b."\n"; - echo "c = ".$this->c."\n"; - } -}; - - -$foo1 = new foo; -$foo1->a = 2; -$foo1->b = 5; -$foo1->display(); -echo $foo1->mul()."\n"; - -echo "-----\n"; - -$bar1 = new bar; -$bar1->a = 4; -$bar1->b = 3; -$bar1->c = 12; -$bar1->display(); -echo $bar1->mul()."\n"; ---EXPECT-- -This is class foo -a = 2 -b = 5 -10 ------ -This is class bar -a = 4 -b = 3 -c = 12 -12 diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt deleted file mode 100755 index cca528e29c..0000000000 --- a/tests/classes/inheritance_002.phpt +++ /dev/null @@ -1,71 +0,0 @@ ---TEST-- -ZE2 Constructor precedence ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---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(); -?> ---EXPECT-- -### 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 deleted file mode 100755 index a22e5cce58..0000000000 --- a/tests/classes/inheritance_003.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -ZE2 method inheritance without interfaces ---FILE-- -<?php - -class A -{ - function f($x) {} -} - -class B extends A -{ - function f() {} -} - -?> -===DONE=== ---EXPECTF-- - -Strict Standards: Declaration of B::f() should be compatible with that of A::f() in %sinheritance_003.php on line %d -===DONE=== diff --git a/tests/classes/inheritance_004.phpt b/tests/classes/inheritance_004.phpt deleted file mode 100755 index 9c81970cc2..0000000000 --- a/tests/classes/inheritance_004.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -ZE2 method inheritance without interfaces ---FILE-- -<?php - -class A -{ - function f() {} -} - -class B extends A -{ - function f($x) {} -} - -?> -===DONE=== ---EXPECTF-- - -Strict Standards: Declaration of B::f() should be compatible with that of A::f() in %sinheritance_004.php on line %d -===DONE=== diff --git a/tests/classes/interface_and_extends.phpt b/tests/classes/interface_and_extends.phpt deleted file mode 100755 index f9040ae4a9..0000000000 --- a/tests/classes/interface_and_extends.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 a class cannot extend an interface ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface Test -{ - function show(); -} - -class Tester extends Test -{ - function show() { - echo __METHOD__ . "\n"; - } -} - -$o = new Tester; -$o->show(); - -?> -===DONE=== ---EXPECTF-- -Fatal error: Class Tester cannot extend from interface Test in %sinterface_and_extends.php on line %d diff --git a/tests/classes/interface_class.phpt b/tests/classes/interface_class.phpt deleted file mode 100644 index 22520de1f9..0000000000 --- a/tests/classes/interface_class.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -ZE2 A class can only implement interfaces ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class base { -} - -class derived implements base { -} -?> ---EXPECTF-- -Fatal error: derived cannot implement base - it is not an interface in %s on line %d diff --git a/tests/classes/interface_doubled.phpt b/tests/classes/interface_doubled.phpt deleted file mode 100644 index e1dd31fd4d..0000000000 --- a/tests/classes/interface_doubled.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -ZE2 An interface extends base interfaces ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface if_a { - function f_a(); -} - -interface if_b { - function f_b(); -} - -interface if_c extends if_a, if_b { - function f_c(); -} - -interface if_d extends if_a, if_b { - function f_d(); -} - -interface if_e { - 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"); - } -} - -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() {} -} - -$t = new class_a(); -echo $t->test('if_a'); -echo $t->test('if_b'); -echo $t->test('if_c'); -echo $t->test('if_d'); -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() {} -} - -$t = new class_b(); -echo $t->test('if_a'); -echo $t->test('if_b'); -echo $t->test('if_c'); -echo $t->test('if_d'); -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() {} -} - -$t = new class_c(); -echo $t->test('if_a'); -echo $t->test('if_b'); -echo $t->test('if_c'); -echo $t->test('if_d'); -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() {} -} - -$t = new class_d(); -echo $t->test('if_a'); -echo $t->test('if_b'); -echo $t->test('if_c'); -echo $t->test('if_d'); -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() {} -} - -$t = new class_e(); -echo $t->test('if_a'); -echo $t->test('if_b'); -echo $t->test('if_c'); -echo $t->test('if_d'); -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() {} -} - -$t = new class_f(); -echo $t->test('if_a'); -echo $t->test('if_b'); -echo $t->test('if_c'); -echo $t->test('if_d'); -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() {} -} - -$t = new class_g(); -echo $t->test('if_a'); -echo $t->test('if_b'); -echo $t->test('if_c'); -echo $t->test('if_d'); -echo $t->test('if_e'); - -?> -===DONE=== ---EXPECTF-- -class_a -is_a(class_a, if_a) yes -is_a(class_a, if_b) no -is_a(class_a, if_c) no -is_a(class_a, if_d) no -is_a(class_a, if_e) no -class_b -is_a(class_b, if_a) yes -is_a(class_b, if_b) yes -is_a(class_b, if_c) no -is_a(class_b, if_d) no -is_a(class_b, if_e) no -class_c -is_a(class_c, if_a) yes -is_a(class_c, if_b) yes -is_a(class_c, if_c) yes -is_a(class_c, if_d) no -is_a(class_c, if_e) no -class_d -is_a(class_d, if_a) yes -is_a(class_d, if_b) yes -is_a(class_d, if_c) no -is_a(class_d, if_d) yes -is_a(class_d, if_e) no -class_e -is_a(class_e, if_a) yes -is_a(class_e, if_b) yes -is_a(class_e, if_c) yes -is_a(class_e, if_d) yes -is_a(class_e, if_e) no -class_f -is_a(class_f, if_a) no -is_a(class_f, if_b) no -is_a(class_f, if_c) no -is_a(class_f, if_d) no -is_a(class_f, if_e) yes -class_g -is_a(class_g, if_a) yes -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 deleted file mode 100644 index e33a4da002..0000000000 --- a/tests/classes/interface_implemented.phpt +++ /dev/null @@ -1,103 +0,0 @@ ---TEST-- -ZE2 An interface is inherited ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface if_a { - function f_a(); -} - -interface if_b extends if_a { - 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"; - } -} - -class derived_a extends base implements if_a { - function f_a() {} -} - -class derived_b extends base implements if_a, if_b { - function f_a() {} - function f_b() {} -} - -class derived_c extends derived_a implements if_b { - function f_b() {} -} - -class derived_d extends derived_c { -} - -$t = new base(); -$t->test(); - -$t = new derived_a(); -$t->test(); - -$t = new derived_b(); -$t->test(); - -$t = new derived_c(); -$t->test(); - -$t = new derived_d(); -$t->test(); - -?> ---EXPECTF-- -is_a(base, base) = yes -is_a(base, derived_a) = no -is_a(base, derived_b) = no -is_a(base, derived_c) = no -is_a(base, derived_d) = no -is_a(base, if_a) = no -is_a(base, if_b) = no - -is_a(derived_a, base) = yes -is_a(derived_a, derived_a) = yes -is_a(derived_a, derived_b) = no -is_a(derived_a, derived_c) = no -is_a(derived_a, derived_d) = no -is_a(derived_a, if_a) = yes -is_a(derived_a, if_b) = no - -is_a(derived_b, base) = yes -is_a(derived_b, derived_a) = no -is_a(derived_b, derived_b) = yes -is_a(derived_b, derived_c) = no -is_a(derived_b, derived_d) = no -is_a(derived_b, if_a) = yes -is_a(derived_b, if_b) = yes - -is_a(derived_c, base) = yes -is_a(derived_c, derived_a) = yes -is_a(derived_c, derived_b) = no -is_a(derived_c, derived_c) = yes -is_a(derived_c, derived_d) = no -is_a(derived_c, if_a) = yes -is_a(derived_c, if_b) = yes - -is_a(derived_d, base) = yes -is_a(derived_d, derived_a) = yes -is_a(derived_d, derived_b) = no -is_a(derived_d, derived_c) = yes -is_a(derived_d, derived_d) = yes -is_a(derived_d, if_a) = yes -is_a(derived_d, if_b) = yes diff --git a/tests/classes/interface_instantiate.phpt b/tests/classes/interface_instantiate.phpt deleted file mode 100644 index 61c4e6b95b..0000000000 --- a/tests/classes/interface_instantiate.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -ZE2 An interface cannot be instantiated ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface if_a { - function f_a(); -} - -$t = new if_a(); - -?> ---EXPECTF-- -Fatal error: Cannot instantiate interface if_a in %s on line %d diff --git a/tests/classes/interface_member.phpt b/tests/classes/interface_member.phpt deleted file mode 100644 index 329c0728b5..0000000000 --- a/tests/classes/interface_member.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -ZE2 An interface cannot have properties ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface if_a { - public $member; -} -?> ---EXPECTF-- -Fatal error: Interfaces may not include member variables in %s on line %d diff --git a/tests/classes/interface_method.phpt b/tests/classes/interface_method.phpt deleted file mode 100644 index 3570b35928..0000000000 --- a/tests/classes/interface_method.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -ZE2 An interface method must be abstract ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface if_a { - function err() {}; -} - -?> ---EXPECTF-- - -Fatal error: Interface function if_a::err() cannot contain body %s on line %d diff --git a/tests/classes/interface_method_final.phpt b/tests/classes/interface_method_final.phpt deleted file mode 100644 index 01e599c5b9..0000000000 --- a/tests/classes/interface_method_final.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -ZE2 An interface method cannot be final ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class if_a { - abstract final function err(); -} - -?> ---EXPECTF-- - -Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d diff --git a/tests/classes/interface_method_private.phpt b/tests/classes/interface_method_private.phpt deleted file mode 100644 index aa46a033a6..0000000000 --- a/tests/classes/interface_method_private.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -ZE2 An interface method cannot be private ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface if_a { - abstract private function err(); -} - -?> ---EXPECTF-- - -Fatal error: Access type for interface method if_a::err() must be omitted in %s on line %d diff --git a/tests/classes/interface_must_be_implemented.phpt b/tests/classes/interface_must_be_implemented.phpt deleted file mode 100644 index a4d79704e1..0000000000 --- a/tests/classes/interface_must_be_implemented.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -ZE2 An interface must be implemented ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface if_a { - function f_a(); -} - -class derived_a implements if_a { -} - -?> ---EXPECTF-- -Fatal error: Class derived_a contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (if_a::f_a) in %s on line %d diff --git a/tests/classes/interface_optional_arg.phpt b/tests/classes/interface_optional_arg.phpt deleted file mode 100755 index 05f2fc41df..0000000000 --- a/tests/classes/interface_optional_arg.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ZE2 An interface method allows additional default arguments ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -error_reporting(4095); - -interface test { - public function bar(); -} - -class foo implements test { - - public function bar($foo = NULL) { - echo "foo\n"; - } -} - -$foo = new foo; -$foo->bar(); - -?> ---EXPECT-- -foo - diff --git a/tests/classes/interfaces_001.phpt b/tests/classes/interfaces_001.phpt deleted file mode 100644 index 41e1f6776d..0000000000 --- a/tests/classes/interfaces_001.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 interfaces ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface Throwable { - public function getMessage(); -} - -class Exception_foo implements Throwable { - public $foo = "foo"; - - public function getMessage() { - return $this->foo; - } -} - -$foo = new Exception_foo; -echo $foo->getMessage() . "\n"; - -?> ---EXPECT-- -foo - diff --git a/tests/classes/interfaces_002.phpt b/tests/classes/interfaces_002.phpt deleted file mode 100644 index d26b5349bf..0000000000 --- a/tests/classes/interfaces_002.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -ZE2 interface with an unimplemented method ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface Throwable { - public function getMessage(); - public function getErrno(); -} - -class Exception_foo implements Throwable { - public $foo = "foo"; - - public function getMessage() { - return $this->foo; - } -} - -// this should die -- Exception class must be abstract... -$foo = new Exception_foo; -echo "Message: " . $foo->getMessage() . "\n"; - -?> -===DONE=== ---EXPECTF-- - -Fatal error: Class Exception_foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Throwable::getErrno) in %s on line %d diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt deleted file mode 100755 index f9ab92bb15..0000000000 --- a/tests/classes/interfaces_003.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 interface and __construct ---FILE-- -<?php - -class MyObject {} - -interface MyInterface -{ - public function __construct(MyObject $o); -} - -class MyTestClass implements MyInterface -{ - public function __construct(MyObject $o) - { - } -} - -$obj = new MyTestClass; - -?> -===DONE=== ---EXPECTF-- - -Catchable fatal error: Argument 1 passed to MyTestClass::__construct() must be an instance of MyObject, none given, called in %sinterfaces_003.php on line %d diff --git a/tests/classes/iterators_001.phpt b/tests/classes/iterators_001.phpt deleted file mode 100755 index 02e3610782..0000000000 --- a/tests/classes/iterators_001.phpt +++ /dev/null @@ -1,200 +0,0 @@ ---TEST-- -ZE2 iterators and foreach ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class c_iter implements Iterator { - - 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 "???"; - } - } -} - -class c implements IteratorAggregate { - - public $max = 3; - - 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 "===Manual===\n"; -$t = new c(); -for ($iter = $t->getIterator(); $iter->valid(); $iter->next()) { - echo $iter->current() . "\n"; -} - -echo "===foreach/std===\n"; -foreach($t as $v) { - echo "object:$v\n"; -} - -echo "===foreach/rec===\n"; -foreach($t as $v) { - foreach($t as $w) { - echo "double:$v:$w\n"; - } -} - -echo "===foreach/key===\n"; -foreach($t as $i => $v) { - echo "object:$i=>$v\n"; -} - -print "Done\n"; -exit(0); -?> ---EXPECT-- -===Array=== -array:0 -array:1 -array:2 -===Manual=== -c::getIterator -c_iter::__construct -c_iter::valid = true -c_iter::current -0 -c_iter::next -c_iter::valid = true -c_iter::current -1 -c_iter::next -c_iter::valid = true -c_iter::current -2 -c_iter::next -c_iter::valid = false -===foreach/std=== -c::getIterator -c_iter::__construct -c_iter::valid = true -c_iter::current -object:0 -c_iter::next -c_iter::valid = true -c_iter::current -object:1 -c_iter::next -c_iter::valid = true -c_iter::current -object:2 -c_iter::next -c_iter::valid = false -===foreach/rec=== -c::getIterator -c_iter::__construct -c_iter::valid = true -c_iter::current -c::getIterator -c_iter::__construct -c_iter::valid = true -c_iter::current -double:0:0 -c_iter::next -c_iter::valid = true -c_iter::current -double:0:1 -c_iter::next -c_iter::valid = true -c_iter::current -double:0:2 -c_iter::next -c_iter::valid = false -c_iter::next -c_iter::valid = true -c_iter::current -c::getIterator -c_iter::__construct -c_iter::valid = true -c_iter::current -double:1:0 -c_iter::next -c_iter::valid = true -c_iter::current -double:1:1 -c_iter::next -c_iter::valid = true -c_iter::current -double:1:2 -c_iter::next -c_iter::valid = false -c_iter::next -c_iter::valid = true -c_iter::current -c::getIterator -c_iter::__construct -c_iter::valid = true -c_iter::current -double:2:0 -c_iter::next -c_iter::valid = true -c_iter::current -double:2:1 -c_iter::next -c_iter::valid = true -c_iter::current -double:2:2 -c_iter::next -c_iter::valid = false -c_iter::next -c_iter::valid = false -===foreach/key=== -c::getIterator -c_iter::__construct -c_iter::valid = true -c_iter::current -c_iter::key -object:1st=>0 -c_iter::next -c_iter::valid = true -c_iter::current -c_iter::key -object:2nd=>1 -c_iter::next -c_iter::valid = true -c_iter::current -c_iter::key -object:3rd=>2 -c_iter::next -c_iter::valid = false -Done diff --git a/tests/classes/iterators_002.phpt b/tests/classes/iterators_002.phpt deleted file mode 100755 index 4a58be0324..0000000000 --- a/tests/classes/iterators_002.phpt +++ /dev/null @@ -1,113 +0,0 @@ ---TEST-- -ZE2 iterators and break ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class c_iter implements Iterator { - - 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"; - } -} - -class c implements IteratorAggregate { - - public $max = 3; - - 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; - } -} - -unset($t); - -print "Done\n"; -?> ---EXPECT-- -c::getIterator -c_iter::__construct -c_iter::rewind -c_iter::valid = true -c_iter::current -c_iter::key -c::getIterator -c_iter::__construct -c_iter::rewind -c_iter::valid = true -c_iter::current -double:0:0 -c_iter::__destruct -c_iter::next -c_iter::valid = true -c_iter::current -c_iter::key -c::getIterator -c_iter::__construct -c_iter::rewind -c_iter::valid = true -c_iter::current -double:1:0 -c_iter::__destruct -c_iter::next -c_iter::valid = true -c_iter::current -c_iter::key -c::getIterator -c_iter::__construct -c_iter::rewind -c_iter::valid = true -c_iter::current -double:2:0 -c_iter::__destruct -c_iter::next -c_iter::valid = false -c_iter::__destruct -c::__destruct -Done diff --git a/tests/classes/iterators_003.phpt b/tests/classes/iterators_003.phpt deleted file mode 100755 index 42695db6ba..0000000000 --- a/tests/classes/iterators_003.phpt +++ /dev/null @@ -1,115 +0,0 @@ ---TEST-- -ZE2 iterators and break ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class c_iter implements Iterator { - - 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; - } -} - -class c implements IteratorAggregate { - - public $max = 4; - - 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; - } -} - -print "Done\n"; -?> ---EXPECT-- -c::getIterator -c_iter::__construct -c_iter::rewind -c_iter::valid = true -c_iter::current -continue outer -c_iter::next -c_iter::valid = true -c_iter::current -c::getIterator -c_iter::__construct -c_iter::rewind -c_iter::valid = true -c_iter::current -double:1:0 -c_iter::next -c_iter::valid = true -c_iter::current -continue inner -c_iter::next -c_iter::valid = true -c_iter::current -break inner -c_iter::next -c_iter::valid = true -c_iter::current -c::getIterator -c_iter::__construct -c_iter::rewind -c_iter::valid = true -c_iter::current -double:2:0 -c_iter::next -c_iter::valid = true -c_iter::current -continue inner -c_iter::next -c_iter::valid = true -c_iter::current -break inner -break outer -Done diff --git a/tests/classes/iterators_004.phpt b/tests/classes/iterators_004.phpt deleted file mode 100755 index 3fe05276c3..0000000000 --- a/tests/classes/iterators_004.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -ZE2 iterators must be implemented ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -echo "1st try\n"; - -class c1 {} - -$obj = new c1(); - -foreach($obj as $w) { - 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 "???"; - } - } -} - -$obj = new c2(); - -foreach($obj as $v => $w) { - echo "object:$v=>$w\n"; -} - -print "Done\n"; -?> ---EXPECTF-- -1st try -2nd try -object:max=>3 -object:num=>0 -Done diff --git a/tests/classes/iterators_005.phpt b/tests/classes/iterators_005.phpt deleted file mode 100755 index 005deb92a2..0000000000 --- a/tests/classes/iterators_005.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -ZE2 iterators cannot implement Traversable alone ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class test implements Traversable { -} - -$obj = new test; - -foreach($obj as $v); - -print "Done\n"; -/* the error doesn't show the filename but 'Unknown' */ -?> ---EXPECTF-- -Fatal error: Class test must implement interface Traversable as part of either Iterator or IteratorAggregate in %s on line %d diff --git a/tests/classes/iterators_006.phpt b/tests/classes/iterators_006.phpt deleted file mode 100644 index 47fa69087a..0000000000 --- a/tests/classes/iterators_006.phpt +++ /dev/null @@ -1,87 +0,0 @@ ---TEST-- -ZE2 iterators and array wrapping ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?> ---FILE-- -<?php - -class ai implements Iterator { - - private $array; - - function __construct() { - $this->array = array('foo', 'bar', 'baz'); - } - - function rewind() { - reset($this->array); - $this->next(); - } - - function valid() { - return $this->key !== NULL; - } - - function key() { - return $this->key; - } - - function current() { - return $this->current; - } - - function next() { - list($this->key, $this->current) = each($this->array); -// list($key, $current) = each($this->array); -// $this->key = $key; -// $this->current = $current; - } -} - -class a implements IteratorAggregate { - - public function getIterator() { - return new ai(); - } -} - -$array = new a(); - -foreach ($array as $property => $value) { - print "$property: $value\n"; -} - -#$array = $array->getIterator(); -#$array->rewind(); -#$array->valid(); -#var_dump($array->key()); -#var_dump($array->current()); -echo "===2nd===\n"; - -$array = new ai(); - -foreach ($array as $property => $value) { - print "$property: $value\n"; -} - -echo "===3rd===\n"; - -foreach ($array as $property => $value) { - print "$property: $value\n"; -} - -?> -===DONE=== ---EXPECT-- -0: foo -1: bar -2: baz -===2nd=== -0: foo -1: bar -2: baz -===3rd=== -0: foo -1: bar -2: baz -===DONE===
\ No newline at end of file diff --git a/tests/classes/iterators_007.phpt b/tests/classes/iterators_007.phpt deleted file mode 100755 index f2638b31dc..0000000000 --- a/tests/classes/iterators_007.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -ZE2 iterators and exceptions ---FILE-- -<?php -class Test implements Iterator -{ - 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); } -} - -$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++; -} -?> -===DONE=== ---EXPECT-- -Caught in Test::rewind() -Caught in Test::current() -Caught in Test::key() -Current -Caught in Test::next() -Caught in Test::valid() -===DONE=== diff --git a/tests/classes/object_reference_001.phpt b/tests/classes/object_reference_001.phpt deleted file mode 100644 index 74acb5de13..0000000000 --- a/tests/classes/object_reference_001.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ZE2 object references ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Foo { - public $name; - - function Foo() { - $this->name = "I'm Foo!\n"; - } -} - -$foo = new Foo; -echo $foo->name; -$bar = $foo; -$bar->name = "I'm Bar!\n"; - -// In ZE1, we would expect "I'm Foo!" -echo $foo->name; - -?> ---EXPECT-- -I'm Foo! -I'm Bar! diff --git a/tests/classes/private_001.phpt b/tests/classes/private_001.phpt deleted file mode 100644 index 310b9c6434..0000000000 --- a/tests/classes/private_001.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 A private method can only be called inside the class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - private static function show() { - echo "Call show()\n"; - } - - public static function do_show() { - pass::show(); - } -} - -pass::do_show(); -pass::show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call show() - -Fatal error: Call to private method pass::show() from context '' in %s on line %d diff --git a/tests/classes/private_002.phpt b/tests/classes/private_002.phpt deleted file mode 100644 index 258fd3a17d..0000000000 --- a/tests/classes/private_002.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ZE2 A private method cannot be called in another class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - private static function show() { - echo "Call pass::show()\n"; - } - - public static function do_show() { - pass::show(); - } -} - -pass::do_show(); - -class fail { - public static function show() { - echo "Call fail::show()\n"; - pass::show(); - } -} - -fail::show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call pass::show() -Call fail::show() - -Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/tests/classes/private_003.phpt b/tests/classes/private_003.phpt deleted file mode 100644 index 716efbc8c7..0000000000 --- a/tests/classes/private_003.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -ZE2 A private method cannot be called in a derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -ini_set("error_reporting",2039); -class pass { - private static function show() { - echo "Call show()\n"; - } - - protected static function good() { - pass::show(); - } -} - -class fail extends pass { - static function ok() { - pass::good(); - } - - static function not_ok() { - pass::show(); - } -} - -fail::ok(); -fail::not_ok(); // calling a private function - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call show() - -Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/tests/classes/private_003b.phpt b/tests/classes/private_003b.phpt deleted file mode 100644 index 780b2e6b4c..0000000000 --- a/tests/classes/private_003b.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -ZE2 A private method cannot be called in a derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - private function show() { - echo "Call show()\n"; - } - - protected function good() { - $this->show(); - } -} - -class fail extends pass { - public function ok() { - $this->good(); - } - - public function not_ok() { - $this->show(); - } -} - -$t = new fail(); -$t->ok(); -$t->not_ok(); // calling a private function - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call show() - -Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/tests/classes/private_004.phpt b/tests/classes/private_004.phpt deleted file mode 100644 index 027434ab87..0000000000 --- a/tests/classes/private_004.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -ZE2 A private method cannot be called in a derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - private static function show() { - echo "Call show()\n"; - } - - public static function do_show() { - pass::show(); - } -} - -class fail extends pass { - static function do_show() { - fail::show(); - } -} - -pass::do_show(); -fail::do_show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call show() - -Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/tests/classes/private_004b.phpt b/tests/classes/private_004b.phpt deleted file mode 100644 index ea3fe610d3..0000000000 --- a/tests/classes/private_004b.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ZE2 A private method cannot be called in a derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - private function show() { - echo "Call show()\n"; - } - - public function do_show() { - $this->show(); - } -} - -class fail extends pass { - function do_show() { - $this->show(); - } -} - -$t = new pass(); -$t->do_show(); - -$t2 = new fail(); -$t2->do_show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call show() - -Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
\ No newline at end of file diff --git a/tests/classes/private_005.phpt b/tests/classes/private_005.phpt deleted file mode 100644 index 49b2bee3ba..0000000000 --- a/tests/classes/private_005.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -ZE2 A private method cannot be called in a derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - private static function show() { - echo "Call show()\n"; - } - - public static function do_show() { - pass::show(); - } -} - -class fail extends pass { - static function do_show() { - pass::show(); - } -} - -pass::do_show(); -fail::do_show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call show() - -Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/tests/classes/private_005b.phpt b/tests/classes/private_005b.phpt deleted file mode 100644 index ea3fe610d3..0000000000 --- a/tests/classes/private_005b.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ZE2 A private method cannot be called in a derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - private function show() { - echo "Call show()\n"; - } - - public function do_show() { - $this->show(); - } -} - -class fail extends pass { - function do_show() { - $this->show(); - } -} - -$t = new pass(); -$t->do_show(); - -$t2 = new fail(); -$t2->do_show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call show() - -Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
\ No newline at end of file diff --git a/tests/classes/private_006.phpt b/tests/classes/private_006.phpt deleted file mode 100644 index 0bb2b3fe4b..0000000000 --- a/tests/classes/private_006.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -ZE2 A private method can be overwritten in a second derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php -class first { - private static function show() { - echo "Call show()\n"; - } - - public static function do_show() { - first::show(); - } -} - -first::do_show(); - -class second extends first { -} - -second::do_show(); - -class third extends second { -} - -third::do_show(); - -class fail extends third { - static function show() { // cannot be redeclared - echo "Call show()\n"; - } -} - -echo "Done\n"; -?> ---EXPECTF-- -Call show() -Call show() -Call show() -Done diff --git a/tests/classes/private_006b.phpt b/tests/classes/private_006b.phpt deleted file mode 100644 index 950f16a3c4..0000000000 --- a/tests/classes/private_006b.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -ZE2 A private method can be overwritten in a second derived class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class first { - private function show() { - echo "Call show()\n"; - } - - public function do_show() { - $this->show(); - } -} - -$t1 = new first(); -$t1->do_show(); - -class second extends first { -} - -//$t2 = new second(); -//$t2->do_show(); - -class third extends second { - private function show() { - echo "Call show()\n"; - } -} - -$t3 = new third(); -$t3->do_show(); - -echo "Done\n"; -?> ---EXPECTF-- -Call show() -Call show() -Done
\ No newline at end of file diff --git a/tests/classes/private_007.phpt b/tests/classes/private_007.phpt deleted file mode 100644 index 73a38c4562..0000000000 --- a/tests/classes/private_007.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ZE2 A derived class does not know about privates of ancestors ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Bar { - 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"; - } -} - -Foo::pub(); -Foo::priv(); - -echo "Done\n"; -?> ---EXPECTF-- -Bar::priv() -Foo::priv() -Done diff --git a/tests/classes/private_007b.phpt b/tests/classes/private_007b.phpt deleted file mode 100644 index 02ddc25dec..0000000000 --- a/tests/classes/private_007b.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 A derived class does not know about privates of ancestors ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Bar { - public function pub() { - $this->priv(); - } - private function priv() { - echo "Bar::priv()\n"; - } -} -class Foo extends Bar { - public function priv() { - echo "Foo::priv()\n"; - } -} - -$obj = new Foo(); -$obj->pub(); -$obj->priv(); - -echo "Done\n"; -?> ---EXPECTF-- -Bar::priv() -Foo::priv() -Done diff --git a/tests/classes/private_members.phpt b/tests/classes/private_members.phpt deleted file mode 100755 index 1832ea0c43..0000000000 --- a/tests/classes/private_members.phpt +++ /dev/null @@ -1,103 +0,0 @@ ---TEST-- -ZE2 A private member is ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class base -{ - private $member; - - function __construct() - { - echo __METHOD__ . "(begin)\n"; - $this->member = 'base::member'; - $this->test(); - echo __METHOD__ . "(end)\n"; - } - - function test() - { - echo __METHOD__ . "\n"; - print_r($this); - } -} - -class derived extends base -{ - public $member = 'derived::member (default)'; - - function __construct() - { - echo __METHOD__ . "(begin)\n"; - parent::__construct(); - parent::test(); - $this->test(); - $this->member = 'derived::member'; - echo __METHOD__ . "(end)\n"; - } - - function test() - { - parent::test(); - echo __METHOD__ . "\n"; - print_r($this); - } -} - -$t = new derived; -$t->test(); -unset($t); - -echo "Done\n"; - -?> ---EXPECTF-- -derived::__construct(begin) -base::__construct(begin) -base::test -derived Object -( - [member] => derived::member (default) - [member:private] => base::member -) -derived::test -derived Object -( - [member] => derived::member (default) - [member:private] => base::member -) -base::__construct(end) -base::test -derived Object -( - [member] => derived::member (default) - [member:private] => base::member -) -base::test -derived Object -( - [member] => derived::member (default) - [member:private] => base::member -) -derived::test -derived Object -( - [member] => derived::member (default) - [member:private] => base::member -) -derived::__construct(end) -base::test -derived Object -( - [member] => derived::member - [member:private] => base::member -) -derived::test -derived Object -( - [member] => derived::member - [member:private] => base::member -) -Done diff --git a/tests/classes/private_redeclare.phpt b/tests/classes/private_redeclare.phpt deleted file mode 100755 index e3061f1136..0000000000 --- a/tests/classes/private_redeclare.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -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(); - } -} - -$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(); - } -} - -$t = new derived(); -$t->test(); -?> ---EXPECTF-- -base -test -derived -base - -Fatal error: Call to private method base::show() from context 'derived' in %s on line %d diff --git a/tests/classes/protected_001.phpt b/tests/classes/protected_001.phpt deleted file mode 100644 index 19872c6f16..0000000000 --- a/tests/classes/protected_001.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 A protected method can only be called inside the class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - protected static function fail() { - echo "Call fail()\n"; - } - - public static function good() { - pass::fail(); - } -} - -pass::good(); -pass::fail();// must fail because we are calling from outside of class pass - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call fail() - -Fatal error: Call to protected method pass::fail() from context '' in %s on line %d diff --git a/tests/classes/protected_001b.phpt b/tests/classes/protected_001b.phpt deleted file mode 100644 index 4d24a926ea..0000000000 --- a/tests/classes/protected_001b.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ZE2 A protected method can only be called inside the class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - protected function fail() { - echo "Call fail()\n"; - } - - public function good() { - $this->fail(); - } -} - -$t = new pass(); -$t->good(); -$t->fail();// must fail because we are calling from outside of class pass - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call fail() - -Fatal error: Call to protected method pass::fail() from context '' in %s on line %d diff --git a/tests/classes/protected_002.phpt b/tests/classes/protected_002.phpt deleted file mode 100644 index f26ef9c495..0000000000 --- a/tests/classes/protected_002.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ZE2 A protected method cannot be called in another class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - protected static function show() { - echo "Call pass::show()\n"; - } - - public static function do_show() { - pass::show(); - } -} - -pass::do_show(); - -class fail { - public static function show() { - echo "Call fail::show()\n"; - pass::show(); - } -} - -fail::show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Call pass::show() -Call fail::show() - -Fatal error: Call to protected method pass::show() from context 'fail' in %s on line %d diff --git a/tests/classes/serialize_001.phpt b/tests/classes/serialize_001.phpt deleted file mode 100755 index 16c79d415e..0000000000 --- a/tests/classes/serialize_001.phpt +++ /dev/null @@ -1,79 +0,0 @@ ---TEST-- -ZE2 Serializable ---FILE-- -<?php - -class Test implements Serializable -{ - public $data; - - function __construct($data) - { - echo __METHOD__ . "($data)\n"; - $this->data = $data; - } - - function serialize() - { - echo __METHOD__ . "({$this->data})\n"; - return $this->data; - } - - 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"; - } -} - -?> -===DONE=== -<?php exit(0); ?> ---EXPECT-- -========== -string(6) "String" -Test::__construct(String) -Test::serialize(String) -Test::unserialize(String) -object(Test)#1 (1) { - ["data"]=> - string(6) "String" -} -object(Test)#1 (1) { - ["data"]=> - string(6) "String" -} -========== -NULL -Test::__construct() -Test::serialize() -NULL -========== -int(42) -Test::__construct(42) -Test::serialize(42) -Exception: Test::serialize() must return a string or NULL -========== -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 deleted file mode 100644 index ee729b980c..0000000000 --- a/tests/classes/singleton_001.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -ZE2 singleton ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Counter { - private $counter = 0; - - function increment_and_print() { - echo ++$this->counter; - echo "\n"; - } -} - - -class SingletonCounter { - private static $m_instance = NULL; - - static function Instance() { - if (self::$m_instance == NULL) { - self::$m_instance = new Counter(); - } - return self::$m_instance; - } -} - -SingletonCounter::Instance()->increment_and_print(); -SingletonCounter::Instance()->increment_and_print(); -SingletonCounter::Instance()->increment_and_print(); - -?> ---EXPECT-- -1 -2 -3 diff --git a/tests/classes/static_mix_1.phpt b/tests/classes/static_mix_1.phpt deleted file mode 100644 index ecc9c01a28..0000000000 --- a/tests/classes/static_mix_1.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -ZE2 You cannot overload a static method with a non static method ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - static function show() { - echo "Call to function pass::show()\n"; - } -} - -class fail extends pass { - function show() { - echo "Call to function fail::show()\n"; - } -} - -pass::show(); -fail::show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Cannot make static method pass::show() non static in class fail in %s on line %d
\ No newline at end of file diff --git a/tests/classes/static_mix_2.phpt b/tests/classes/static_mix_2.phpt deleted file mode 100644 index bbdaedf50a..0000000000 --- a/tests/classes/static_mix_2.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ZE2 You cannot overload a non static method with a static method ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class pass { - function show() { - echo "Call to function pass::show()\n"; - } -} - -class fail extends pass { - static function show() { - echo "Call to function fail::show()\n"; - } -} - -$t = new pass(); -$t->show(); -fail::show(); - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Cannot make non static method pass::show() static in class fail in %s on line %d
\ No newline at end of file diff --git a/tests/classes/static_properties_001.phpt b/tests/classes/static_properties_001.phpt deleted file mode 100755 index 1c34f68fc5..0000000000 --- a/tests/classes/static_properties_001.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ZE2 Initializing static properties to arrays ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class test { - static public $ar = array(); -} - -var_dump(test::$ar); - -test::$ar[] = 1; - -var_dump(test::$ar); - -echo "Done\n"; -?> ---EXPECTF-- -array(0) { -} -array(1) { - [0]=> - int(1) -} -Done diff --git a/tests/classes/static_this.phpt b/tests/classes/static_this.phpt deleted file mode 100755 index 91b0287195..0000000000 --- a/tests/classes/static_this.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -ZE2 $this can be an argument to a static function ---FILE-- -<?php - -class TestClass -{ - function __construct() - { - self::Test1(); - $this->Test1(); - } - - static function Test1() - { - var_dump($this); - } - - static function Test2($this) - { - var_dump($this); - } -} - -$obj = new TestClass; -TestClass::Test2(new stdClass); - -?> -===DONE=== ---EXPECTF-- - -Notice: Undefined variable: this in %sstatic_this.php on line %d -NULL - -Notice: Undefined variable: this in %sstatic_this.php on line %d -NULL -object(stdClass)#%d (0) { -} -===DONE=== diff --git a/tests/classes/this.phpt b/tests/classes/this.phpt deleted file mode 100755 index 1d9c6236e4..0000000000 --- a/tests/classes/this.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -ZE2 $this cannot be exchanged ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -/* please don't shorten this test. It shows what would happen if - * the fatal error would have been a warning. - */ -class Foo -{ - function replace($other) - { - echo __METHOD__ . "\n"; - $this = $other; - print $this->prop; - print $other->prop; - } - - function indirect($other) - { - echo __METHOD__ . "\n"; - $this = $other; - $result = $this = $other; - print $result->prop; - print $this->prop; - } - - function retrieve(&$other) - { - echo __METHOD__ . "\n"; - $other = $this; - } -} - -$object = new Foo; -$object->prop = "Hello\n"; - -$other = new Foo; -$other->prop = "World\n"; - -$object->replace($other); -$object->indirect($other); - -print $object->prop; // still shows 'Hello' - -$object->retrieve($other); -print $other->prop; // shows 'Hello' - -?> -===DONE=== ---EXPECTF-- -Fatal error: Cannot re-assign $this in %sthis.php on line %d diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt deleted file mode 100755 index 53144ca207..0000000000 --- a/tests/classes/tostring_001.phpt +++ /dev/null @@ -1,130 +0,0 @@ ---TEST-- -ZE2 __toString() ---FILE-- -<?php - -function my_error_handler($errno, $errstr, $errfile, $errline) { - var_dump($errstr); -} - -set_error_handler('my_error_handler'); - -class test1 -{ -} - -class test2 -{ - function __toString() - { - echo __METHOD__ . "()\n"; - return "Converted\n"; - } -} - -class test3 -{ - function __toString() - { - echo __METHOD__ . "()\n"; - return 42; - } -} -echo "====test1====\n"; -$o = new test1; -print_r($o); -var_dump((string)$o); -var_dump($o); - -echo "====test2====\n"; -$o = new test2; -print_r($o); -print $o; -var_dump($o); -echo "====test3====\n"; -echo $o; - -echo "====test4====\n"; -echo "string:".$o; - -echo "====test5====\n"; -echo 1 . $o; -echo 1 , $o; - -echo "====test6====\n"; -echo $o . $o; -echo $o , $o; - -echo "====test7====\n"; -$ar = array(); -$ar[$o->__toString()] = "ERROR"; -echo $ar[$o]; - -echo "====test8====\n"; -var_dump(trim($o)); -var_dump(trim((string)$o)); - -echo "====test9====\n"; -echo sprintf("%s", $o); - -echo "====test10====\n"; -$o = new test3; -var_dump($o); -echo $o; - -?> -====DONE==== ---EXPECTF-- -====test1==== -test1 Object -( -) -string(54) "Object of class test1 could not be converted to string" -string(0) "" -object(test1)#%d (0) { -} -====test2==== -test2 Object -( -) -test2::__toString() -Converted -object(test2)#%d (0) { -} -====test3==== -test2::__toString() -Converted -====test4==== -test2::__toString() -string:Converted -====test5==== -test2::__toString() -1Converted -1test2::__toString() -Converted -====test6==== -test2::__toString() -test2::__toString() -Converted -Converted -test2::__toString() -Converted -test2::__toString() -Converted -====test7==== -test2::__toString() -string(19) "Illegal offset type" -====test8==== -test2::__toString() -string(9) "Converted" -test2::__toString() -string(9) "Converted" -====test9==== -test2::__toString() -Converted -====test10==== -object(test3)#%d (0) { -} -test3::__toString() -string(53) "Method test3::__toString() must return a string value" -====DONE==== diff --git a/tests/classes/tostring_002.phpt b/tests/classes/tostring_002.phpt deleted file mode 100755 index 8a4a7af339..0000000000 --- a/tests/classes/tostring_002.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ZE2 __toString() in __destruct ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Test -{ - function __toString() - { - return "Hello\n"; - } - - function __destruct() - { - echo $this; - } -} - -$o = new Test; -$o = NULL; - -$o = new Test; - -?> -====DONE==== ---EXPECTF-- -Hello -====DONE==== -Hello diff --git a/tests/classes/tostring_003.phpt b/tests/classes/tostring_003.phpt deleted file mode 100755 index 8815bd9407..0000000000 --- a/tests/classes/tostring_003.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 __toString() in __destruct/exception ---FILE-- -<?php - -class Test -{ - function __toString() - { - throw new Exception("Damn!"); - return "Hello\n"; - } - - function __destruct() - { - echo $this; - } -} - -try -{ - $o = new Test; - $o = NULL; -} -catch(Exception $e) -{ - var_dump($e->getMessage()); -} - -?> -====DONE==== ---EXPECTF-- -Fatal error: Method Test::__toString() must not throw an exception in %stostring_003.php on line %d diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt deleted file mode 100644 index f55dd53bf4..0000000000 --- a/tests/classes/type_hinting_001.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -ZE2 class type hinting ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -interface Foo { - function a(Foo $foo); -} - -interface Bar { - function b(Bar $bar); -} - -class FooBar implements Foo, Bar { - function a(Foo $foo) { - // ... - } - - function b(Bar $bar) { - // ... - } -} - -class Blort { -} - -$a = new FooBar; -$b = new Blort; - -$a->a($b); -$a->b($b); - -?> ---EXPECTF-- - -Catchable fatal error: Argument 1 passed to FooBar::a() must implement interface Foo, instance of Blort given, called in %s on line 27 and defined in %s on line 12 diff --git a/tests/classes/type_hinting_002.phpt b/tests/classes/type_hinting_002.phpt deleted file mode 100755 index 7c685bfdba..0000000000 --- a/tests/classes/type_hinting_002.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -ZE2 class type hinting non existing class ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class Foo { - function a(NonExisting $foo) {} -} - -$o = new Foo; -$o->a($o); -?> ---EXPECTF-- -Catchable fatal error: 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 on line %d diff --git a/tests/classes/type_hinting_003.phpt b/tests/classes/type_hinting_003.phpt deleted file mode 100755 index 431d66eabc..0000000000 --- a/tests/classes/type_hinting_003.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -ZE2 class type hinting with arrays ---FILE-- -<?php - -class Test -{ - 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 f3(array $ar = array()) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } - - static function f4(array $ar = array(25)) - { - echo __METHOD__ . "()\n"; - var_dump($ar); - } -} - -Test::f1(array(42)); -Test::f2(NULL); -Test::f2(); -Test::f3(); -Test::f4(); -Test::f1(1); - -?> ---EXPECTF-- -Test::f1() -array(1) { - [0]=> - int(42) -} -Test::f2() -NULL -Test::f2() -NULL -Test::f3() -array(0) { -} -Test::f4() -array(1) { - [0]=> - int(25) -} - -Catchable fatal error: Argument 1 passed to Test::f1() must be an array, integer given, called in %stype_hinting_003.php on line %d and defined in %stype_hinting_003.php on line %d diff --git a/tests/classes/visibility_000a.phpt b/tests/classes/visibility_000a.phpt deleted file mode 100644 index 2524494ff8..0000000000 --- a/tests/classes/visibility_000a.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - protected function f0() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Access level to fail::f0() must be public (as in class same) in %s on line %d diff --git a/tests/classes/visibility_000b.phpt b/tests/classes/visibility_000b.phpt deleted file mode 100644 index 9305467323..0000000000 --- a/tests/classes/visibility_000b.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - private function f0() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Access level to fail::f0() must be public (as in class same) in %s on line %d diff --git a/tests/classes/visibility_000c.phpt b/tests/classes/visibility_000c.phpt deleted file mode 100644 index 064106e979..0000000000 --- a/tests/classes/visibility_000c.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - function f0() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_001a.phpt b/tests/classes/visibility_001a.phpt deleted file mode 100644 index ebd1cc34de..0000000000 --- a/tests/classes/visibility_001a.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - protected function f1() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Access level to fail::f1() must be public (as in class same) in %s on line %d diff --git a/tests/classes/visibility_001b.phpt b/tests/classes/visibility_001b.phpt deleted file mode 100644 index e61078ede5..0000000000 --- a/tests/classes/visibility_001b.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - private function f1() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Access level to fail::f1() must be public (as in class same) in %s on line %d diff --git a/tests/classes/visibility_001c.phpt b/tests/classes/visibility_001c.phpt deleted file mode 100644 index bb1075aaed..0000000000 --- a/tests/classes/visibility_001c.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - function f1() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_002a.phpt b/tests/classes/visibility_002a.phpt deleted file mode 100644 index 6c88d204d2..0000000000 --- a/tests/classes/visibility_002a.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - protected function f2() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Access level to fail::f2() must be public (as in class same) in %s on line %d diff --git a/tests/classes/visibility_002b.phpt b/tests/classes/visibility_002b.phpt deleted file mode 100644 index 71f47c3954..0000000000 --- a/tests/classes/visibility_002b.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - private function f2() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Access level to fail::f2() must be public (as in class same) in %s on line %d diff --git a/tests/classes/visibility_002c.phpt b/tests/classes/visibility_002c.phpt deleted file mode 100644 index 5edae1d068..0000000000 --- a/tests/classes/visibility_002c.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - function f2() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_003a.phpt b/tests/classes/visibility_003a.phpt deleted file mode 100644 index 1693386f81..0000000000 --- a/tests/classes/visibility_003a.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - public function f3() {} -} - -echo "Done\n"; -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_003b.phpt b/tests/classes/visibility_003b.phpt deleted file mode 100644 index fcfdbe3c55..0000000000 --- a/tests/classes/visibility_003b.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - private function f3() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Fatal error: Access level to fail::f3() must be protected (as in class same) or weaker in %s on line %d diff --git a/tests/classes/visibility_003c.phpt b/tests/classes/visibility_003c.phpt deleted file mode 100644 index d94a9c116b..0000000000 --- a/tests/classes/visibility_003c.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - function f3() {} -} - -echo "Done\n"; -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_004a.phpt b/tests/classes/visibility_004a.phpt deleted file mode 100644 index 6f16a09edd..0000000000 --- a/tests/classes/visibility_004a.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - public function f4() {} -} - -echo "Done\n"; -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_004b.phpt b/tests/classes/visibility_004b.phpt deleted file mode 100644 index 74a83185ee..0000000000 --- a/tests/classes/visibility_004b.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - protected function f4() {} -} - -echo "Done\n"; // shouldn't be displayed -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_004c.phpt b/tests/classes/visibility_004c.phpt deleted file mode 100644 index 92a770374e..0000000000 --- a/tests/classes/visibility_004c.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ZE2 A redeclared method must have the same or higher visibility ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class father { - 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() {} -} - -class fail extends same { - function f4() {} -} - -echo "Done\n"; -?> ---EXPECTF-- -Done diff --git a/tests/classes/visibility_005.phpt b/tests/classes/visibility_005.phpt deleted file mode 100755 index 1b15fb5e5b..0000000000 --- a/tests/classes/visibility_005.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -ZE2 foreach and property visibility ---FILE-- -<?php - -class base -{ - public $a=1; - protected $b=2; - private $c=3; - - function f() - { - foreach($this as $k=>$v) { - echo "$k=>$v\n"; - } - } -} - -class derived extends base -{ -} - -$o = new base; -$o->d = 4; -echo "===base::function===\n"; -$o->f(); -echo "===base,foreach===\n"; -foreach($o as $k=>$v) { - echo "$k=>$v\n"; -} - -$o = new derived; -$o->d = 4; -echo "===derived::function===\n"; -$o->f(); -echo "===derived,foreach===\n"; -foreach($o as $k=>$v) { - echo "$k=>$v\n"; -} - -?> ---EXPECT-- -===base::function=== -a=>1 -b=>2 -c=>3 -d=>4 -===base,foreach=== -a=>1 -d=>4 -===derived::function=== -a=>1 -b=>2 -d=>4 -===derived,foreach=== -a=>1 -d=>4 |