diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
| commit | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (patch) | |
| tree | b38e2e5c6974b9a15f103e5cf884cba9fff90ef4 /tests | |
| parent | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (diff) | |
| download | php-upstream/5.2.0.tar.gz | |
Imported Upstream version 5.2.0upstream/5.2.0
Diffstat (limited to 'tests')
36 files changed, 673 insertions, 271 deletions
diff --git a/tests/classes/abstract_by_interface_001.phpt b/tests/classes/abstract_by_interface_001.phpt new file mode 100755 index 000000000..7565fdf45 --- /dev/null +++ b/tests/classes/abstract_by_interface_001.phpt @@ -0,0 +1,33 @@ +--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 new file mode 100755 index 000000000..77c5619df --- /dev/null +++ b/tests/classes/abstract_by_interface_002.phpt @@ -0,0 +1,33 @@ +--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_static.phpt b/tests/classes/abstract_static.phpt index 2e46e9dc0..f25d7cff4 100644 --- a/tests/classes/abstract_static.phpt +++ b/tests/classes/abstract_static.phpt @@ -1,21 +1,29 @@ --TEST-- -ZE2 A static abstrcat method may not be called ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +ZE2 A static abstract methods --FILE-- <?php -abstract class fail { - abstract static function show(); +interface showable +{ + static function show(); } -class pass extends fail { +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 @@ -23,4 +31,6 @@ 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 +Strict Standards: Static function fail::func() should not be abstract in %stests/classes/abstract_static.php(%d) : eval()'d code on line %d + +Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::func) in %s/tests/classes/abstract_static.php(%d) : eval()'d code on line %d diff --git a/tests/classes/abstract_user_call.phpt b/tests/classes/abstract_user_call.phpt new file mode 100755 index 000000000..0e1ddbe79 --- /dev/null +++ b/tests/classes/abstract_user_call.phpt @@ -0,0 +1,30 @@ +--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/ctor_in_interface_01.phpt b/tests/classes/ctor_in_interface_01.phpt new file mode 100755 index 000000000..f6f9b66ea --- /dev/null +++ b/tests/classes/ctor_in_interface_01.phpt @@ -0,0 +1,19 @@ +--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 new file mode 100755 index 000000000..a0dfe8778 --- /dev/null +++ b/tests/classes/ctor_in_interface_02.phpt @@ -0,0 +1,35 @@ +--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 new file mode 100755 index 000000000..953d6822f --- /dev/null +++ b/tests/classes/ctor_in_interface_03.phpt @@ -0,0 +1,23 @@ +--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 new file mode 100755 index 000000000..0016244c1 --- /dev/null +++ b/tests/classes/ctor_in_interface_04.phpt @@ -0,0 +1,26 @@ +--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_visibility.phpt b/tests/classes/ctor_visibility.phpt new file mode 100755 index 000000000..8d3b1c5c5 --- /dev/null +++ b/tests/classes/ctor_visibility.phpt @@ -0,0 +1,69 @@ +--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/factory_and_singleton_003.phpt b/tests/classes/factory_and_singleton_003.phpt index d81cc4642..3d50a810a 100755 --- a/tests/classes/factory_and_singleton_003.phpt +++ b/tests/classes/factory_and_singleton_003.phpt @@ -15,4 +15,4 @@ $obj = new test; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to protected test::__construct() from context '' %sfactory_and_singleton_003.php on line %d +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 index 01c53d85a..14edcb1fc 100755 --- a/tests/classes/factory_and_singleton_004.phpt +++ b/tests/classes/factory_and_singleton_004.phpt @@ -15,4 +15,4 @@ $obj = new test; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Call to private test::__construct() from context '' %sfactory_and_singleton_004.php on line %d +Fatal error: Call to private test::__construct() from invalid context in %s on line %d diff --git a/tests/classes/inheritance_003.phpt b/tests/classes/inheritance_003.phpt new file mode 100755 index 000000000..a22e5cce5 --- /dev/null +++ b/tests/classes/inheritance_003.phpt @@ -0,0 +1,21 @@ +--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 new file mode 100755 index 000000000..9c81970cc --- /dev/null +++ b/tests/classes/inheritance_004.phpt @@ -0,0 +1,21 @@ +--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_construct.phpt b/tests/classes/interface_construct.phpt deleted file mode 100755 index b7b641653..000000000 --- a/tests/classes/interface_construct.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST--
-ZE2 An interface constructor signature must not be inherited
---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 __construct($foo);
-}
-
-class foo implements test {
- public function __construct() {
- echo "foo\n";
- }
-}
-
-$foo = new foo;
-
-?>
---EXPECT--
-foo
-
diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt index 46ae8290a..f9ab92bb1 100755 --- a/tests/classes/interfaces_003.phpt +++ b/tests/classes/interfaces_003.phpt @@ -7,27 +7,20 @@ class MyObject {} interface MyInterface { - public function __construct(Object $o); + public function __construct(MyObject $o); } class MyTestClass implements MyInterface { - public function __construct(Object $o) + public function __construct(MyObject $o) { } } $obj = new MyTestClass; -class MyTestFail -{ - public function __construct() - { - } -} - ?> ===DONE=== --EXPECTF-- -Fatal error: Argument 1 passed to MyTestClass::__construct() must be an object of class Object, called in %sinterfaces_003.php on line %d +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/tostring.phpt b/tests/classes/tostring.phpt deleted file mode 100644 index 7253cd4c7..000000000 --- a/tests/classes/tostring.phpt +++ /dev/null @@ -1,86 +0,0 @@ ---TEST-- -ZE2 __toString() ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ---FILE-- -<?php - -class test1 { -} - -class test2 { - function __toString() { - echo __METHOD__ . "()\n"; - return "Converted\n"; - } -} - -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 "====test6====\n"; -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); -?> -====DONE!==== ---EXPECTF-- -====test1==== -test1 Object -( -) -string(1%d) "Object id #%d" -object(test1)#%d (%d) { -} -====test2==== -test2 Object -( -) -test2::__toString() -Converted -object(test2)#%d (%d) { -} -====test3==== -test2::__toString() -Converted -====test4==== -string:Object id #%d====test5==== -1Object id #%d====test6==== -Object id #%dObject id #2====test7==== -test2::__toString() - -Warning: Illegal offset type in %stostring.php on line %d -====test8==== - -Notice: Object of class test2 to string conversion in %stostring.php on line %d -string(6) "Object" -string(1%d) "Object id #%d" -====test9==== -Object id #%d====DONE!==== diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt new file mode 100755 index 000000000..53144ca20 --- /dev/null +++ b/tests/classes/tostring_001.phpt @@ -0,0 +1,130 @@ +--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 new file mode 100755 index 000000000..8a4a7af33 --- /dev/null +++ b/tests/classes/tostring_002.phpt @@ -0,0 +1,31 @@ +--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 new file mode 100755 index 000000000..8815bd940 --- /dev/null +++ b/tests/classes/tostring_003.phpt @@ -0,0 +1,33 @@ +--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 index 82241298d..f55dd53bf 100644 --- a/tests/classes/type_hinting_001.phpt +++ b/tests/classes/type_hinting_001.phpt @@ -35,4 +35,4 @@ $a->b($b); ?> --EXPECTF-- -Fatal error: Argument 1 passed to FooBar::a() must implement interface Foo, called in %s on line 27 and defined in %s on line 12 +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 index 4cb75b1b8..7c685bfdb 100755 --- a/tests/classes/type_hinting_002.phpt +++ b/tests/classes/type_hinting_002.phpt @@ -13,5 +13,4 @@ $o = new Foo; $o->a($o); ?> --EXPECTF-- - -Fatal error: Class 'NonExisting' not found in %stype_hinting_002.php on line %d +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 index 4a83dd419..431d66eab 100755 --- a/tests/classes/type_hinting_003.phpt +++ b/tests/classes/type_hinting_003.phpt @@ -57,4 +57,4 @@ array(1) { int(25) } -Fatal error: Argument 1 passed to Test::f1() must be an array, called in %stype_hinting_003.php on line %d and defined in %stype_hinting_003.php on line %d +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/lang/034.phpt b/tests/lang/034.phpt index 9c640415d..211544a66 100644 --- a/tests/lang/034.phpt +++ b/tests/lang/034.phpt @@ -2,14 +2,14 @@ Bug #12647 (Locale settings affecting float parsing) --SKIPIF-- <?php # try to activate a german locale -if (setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge") === FALSE) { +if (setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1") === FALSE) { print "skip"; } ?> --FILE-- <?php # activate the german locale -setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge"); +setlocale(LC_NUMERIC, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1"); echo (float)"3.14", "\n"; ?> diff --git a/tests/lang/bug22367.phpt b/tests/lang/bug22367.phpt deleted file mode 100644 index 364472b46..000000000 --- a/tests/lang/bug22367.phpt +++ /dev/null @@ -1,131 +0,0 @@ ---TEST-- -Bug #22367 (weird zval allocation problem) ---INI-- -error_reporting=4095 -zend.ze1_compatibility_mode=1 ---FILE-- -<?php - -class foo -{ - public $test = array(0, 1, 2, 3, 4); - - function a($arg) { - var_dump(array_key_exists($arg, $this->test)); - return $this->test[$arg]; - } - - function b() { - @$this->c(); - - $zero = $this->test[0]; - $one = $this->test[1]; - $two = $this->test[2]; - $three = $this->test[3]; - $four = $this->test[4]; - return array($zero, $one, $two, $three, $four); - } - - function c() { - return $this->a($this->d()); - } - - function d() {} -} - -class bar extends foo -{ - public $i = 0; - public $idx; - - function bar($idx) { - $this->idx = $idx; - } - - function &a($arg){ - return parent::a($arg); - } - function d(){ - return $this->idx; - } -} - -$a = new bar(5); -var_dump($a->idx); -$a->c(); -$b = $a->b(); -var_dump($b); -var_dump($a->test); - -$a = new bar(2); -var_dump($a->idx); -@$a->c(); -$b = $a->b(); -var_dump($b); -var_dump($a->test); - -?> ---EXPECTF-- -Strict Standards: Declaration of bar::a() should be compatible with that of foo::a() in %sbug22367.php on line %d - -Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug22367.php on line %d -int(5) -bool(false) - -Notice: Undefined offset: 5 in %sbug22367.php on line %d - -Notice: Only variable references should be returned by reference in %sbug22367.php on line %d -bool(false) -array(5) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(4) -} -array(5) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(4) -} - -Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug22367.php on line %d -int(2) -bool(true) -bool(true) -array(5) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(4) -} -array(5) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - int(2) - [3]=> - int(3) - [4]=> - int(4) -} diff --git a/tests/lang/bug24658.phpt b/tests/lang/bug24658.phpt index d9bf0f566..944fe44ce 100644 --- a/tests/lang/bug24658.phpt +++ b/tests/lang/bug24658.phpt @@ -53,4 +53,4 @@ int(2) object(foo)#%d (0) { } -Fatal error: Argument 1 passed to typehint() must be an object of class foo in %s on line %d +Catchable fatal error: Argument 1 passed to typehint() must be an instance of foo, integer given in %s on line %d diff --git a/tests/lang/bug38579.inc b/tests/lang/bug38579.inc new file mode 100755 index 000000000..f822e6d84 --- /dev/null +++ b/tests/lang/bug38579.inc @@ -0,0 +1,3 @@ +<?php
+echo "ok\n";
+?>
diff --git a/tests/lang/bug38579.phpt b/tests/lang/bug38579.phpt new file mode 100755 index 000000000..fbf98a962 --- /dev/null +++ b/tests/lang/bug38579.phpt @@ -0,0 +1,16 @@ +--TEST--
+Bug #38579 (include_once() may include the same file twice)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+?>
+--FILE--
+<?php
+$file = dirname(__FILE__)."/bug38579.inc";
+include_once(strtolower($file));
+include_once(strtoupper($file));
+?>
+--EXPECT--
+ok
diff --git a/tests/lang/catchable_error_001.phpt b/tests/lang/catchable_error_001.phpt new file mode 100644 index 000000000..f6bbdd976 --- /dev/null +++ b/tests/lang/catchable_error_001.phpt @@ -0,0 +1,22 @@ +--TEST-- +Catchable fatal error [1] +--FILE-- +<?php + class Foo { + } + + function blah (Foo $a) + { + } + + function error() + { + $a = func_get_args(); + var_dump($a); + } + + blah (new StdClass); + echo "ALIVE!\n"; +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_001.php on line 15 and defined in %scatchable_error_001.php on line 5 diff --git a/tests/lang/catchable_error_002.phpt b/tests/lang/catchable_error_002.phpt new file mode 100644 index 000000000..c1762b2db --- /dev/null +++ b/tests/lang/catchable_error_002.phpt @@ -0,0 +1,37 @@ +--TEST-- +Catchable fatal error [2] +--FILE-- +<?php + class Foo { + } + + function blah (Foo $a) + { + } + + function error() + { + $a = func_get_args(); + var_dump($a); + } + + set_error_handler('error'); + + blah (new StdClass); + echo "ALIVE!\n"; +?> +--EXPECTF-- +array(5) { + [0]=> + int(4096) + [1]=> + string(%d) "Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_002.php on line %d and defined" + [2]=> + string(%d) "%scatchable_error_002.php" + [3]=> + int(5) + [4]=> + array(0) { + } +} +ALIVE! diff --git a/tests/lang/type_hints_001.phpt b/tests/lang/type_hints_001.phpt index 2b5f6c828..57808d474 100644 --- a/tests/lang/type_hints_001.phpt +++ b/tests/lang/type_hints_001.phpt @@ -23,4 +23,4 @@ type_hint_foo($bar); ?> --EXPECTF-- -Fatal error: Argument 1 passed to type_hint_foo() must be an instance of Foo, called in %s on line 16 and defined in %s on line 9 +Catchable fatal error: Argument 1 passed to type_hint_foo() must be an instance of Foo, instance of Bar given, called in %s on line 16 and defined in %s on line 9 diff --git a/tests/lang/type_hints_002.phpt b/tests/lang/type_hints_002.phpt new file mode 100644 index 000000000..b21240a79 --- /dev/null +++ b/tests/lang/type_hints_002.phpt @@ -0,0 +1,28 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php +class P { } +class T { + function f(P $p = NULL) { + var_dump($p); + echo "-\n"; + } +} + +$o=new T(); +$o->f(new P); +$o->f(); +$o->f(NULL); +?> +--EXPECT-- +object(P)#2 (0) { +} +- +NULL +- +NULL +- + diff --git a/tests/lang/type_hints_003.phpt b/tests/lang/type_hints_003.phpt new file mode 100644 index 000000000..0ef3e3516 --- /dev/null +++ b/tests/lang/type_hints_003.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php +class T { + function f(P $p = 42) { + } +} +?> +--EXPECTF-- + +Fatal error: Default value for parameters with a class type hint can only be NULL in %stype_hints_003.php on line 3 diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt index b54cbc50e..d16a66ef7 100644 --- a/tests/run-test/test005.phpt +++ b/tests/run-test/test005.phpt @@ -24,7 +24,7 @@ var_dump($php_errormsg); ?> --EXPECTF-- string(1) "1" -string(4) "4095" +string(4) "8191" string(1) "0" string(1) "1" string(1) "0" diff --git a/tests/run-test/test008.phpt b/tests/run-test/test008.phpt index 14fff59bd..41733d96f 100644 --- a/tests/run-test/test008.phpt +++ b/tests/run-test/test008.phpt @@ -25,7 +25,7 @@ var_dump($php_errormsg); --EXPECTF-- %s: %sivision by zero in %s on line %d string(1) "1" -string(4) "4095" +string(4) "8191" string(1) "0" string(1) "1" string(1) "0" diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt index 7916ff235..a7d360dc6 100644 --- a/tests/run-test/test008a.phpt +++ b/tests/run-test/test008a.phpt @@ -24,7 +24,7 @@ var_dump($php_errormsg); ?> --EXPECTF-- string(1) "1" -string(4) "4095" +string(4) "8191" string(1) "0" string(1) "1" string(1) "0" diff --git a/tests/run-test/test010.phpt b/tests/run-test/test010.phpt new file mode 100644 index 000000000..cc3ca3591 --- /dev/null +++ b/tests/run-test/test010.phpt @@ -0,0 +1,17 @@ +--TEST-- +STDIN input +--FILE-- +<?php +var_dump(stream_get_contents(STDIN)); +var_dump(stream_get_contents(fopen('php://stdin', 'r'))); +var_dump(file_get_contents('php://stdin')); +?> +--STDIN-- +fooBar +use this to input some thing to the php script +--EXPECT-- +string(54) "fooBar +use this to input some thing to the php script +" +string(0) "" +string(0) "" |
