diff options
Diffstat (limited to 'tests/lang')
| -rw-r--r-- | tests/lang/034.phpt | 4 | ||||
| -rw-r--r-- | tests/lang/bug22367.phpt | 131 | ||||
| -rw-r--r-- | tests/lang/bug24658.phpt | 2 | ||||
| -rwxr-xr-x | tests/lang/bug38579.inc | 3 | ||||
| -rwxr-xr-x | tests/lang/bug38579.phpt | 16 | ||||
| -rw-r--r-- | tests/lang/catchable_error_001.phpt | 22 | ||||
| -rw-r--r-- | tests/lang/catchable_error_002.phpt | 37 | ||||
| -rw-r--r-- | tests/lang/type_hints_001.phpt | 2 | ||||
| -rw-r--r-- | tests/lang/type_hints_002.phpt | 28 | ||||
| -rw-r--r-- | tests/lang/type_hints_003.phpt | 14 |
10 files changed, 124 insertions, 135 deletions
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 |
