summaryrefslogtreecommitdiff
path: root/Zend/tests
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2013-12-15 16:55:29 +0800
committerXinchen Hui <laruence@gmail.com>2013-12-15 16:55:29 +0800
commit5eb8d9d70009c0bf9bfbbf511f2713e64dc8ee83 (patch)
tree2480a26e79d85b4b7f2eacb5a2187eb13f029094 /Zend/tests
parent10964b78548a5878254f5aa75f4cfdcedb0543bc (diff)
parent904721189ff949c67795ec418f04b67951cbd57b (diff)
downloadphp-git-5eb8d9d70009c0bf9bfbbf511f2713e64dc8ee83.tar.gz
Merge branch 'PHP-5.6' of https://git.php.net/push/php-src into PHP-5.6
Diffstat (limited to 'Zend/tests')
-rw-r--r--Zend/tests/bug30820.phpt1
-rw-r--r--Zend/tests/bug65784.phpt2
-rw-r--r--Zend/tests/bug66252.phpt14
-rw-r--r--Zend/tests/class_properties_dynamic.phpt13
-rw-r--r--Zend/tests/class_properties_static.phpt20
-rw-r--r--Zend/tests/closure_018.phpt5
-rw-r--r--Zend/tests/closure_019.phpt3
-rw-r--r--Zend/tests/constant_expressions.phpt91
-rw-r--r--Zend/tests/constant_expressions_classes.phpt43
-rw-r--r--Zend/tests/constant_expressions_dynamic.phpt11
-rw-r--r--Zend/tests/finally_goto_001.phpt14
-rw-r--r--Zend/tests/finally_goto_002.phpt14
-rw-r--r--Zend/tests/finally_goto_003.phpt15
-rw-r--r--Zend/tests/finally_goto_004.phpt14
-rw-r--r--Zend/tests/function_arguments_003.phpt17
-rw-r--r--Zend/tests/incompat_ctx_user.phpt20
-rw-r--r--Zend/tests/static_variable.phpt29
-rw-r--r--Zend/tests/use_const/alias.phpt26
-rw-r--r--Zend/tests/use_const/basic.phpt22
-rw-r--r--Zend/tests/use_const/case_sensivity.phpt12
-rw-r--r--Zend/tests/use_const/conflicting_use.phpt21
-rw-r--r--Zend/tests/use_const/conflicting_use_alias.phpt18
-rw-r--r--Zend/tests/use_const/define_imported.phpt14
-rw-r--r--Zend/tests/use_const/define_imported_before.phpt18
-rw-r--r--Zend/tests/use_const/includes/foo_bar.php5
-rw-r--r--Zend/tests/use_const/includes/foo_php_version.php5
-rw-r--r--Zend/tests/use_const/includes/global_bar.php3
-rw-r--r--Zend/tests/use_const/includes/global_baz.php3
-rw-r--r--Zend/tests/use_const/no_global_fallback.phpt14
-rw-r--r--Zend/tests/use_const/self_parent.phpt12
-rw-r--r--Zend/tests/use_const/shadow_core.phpt16
-rw-r--r--Zend/tests/use_const/shadow_global.phpt25
-rw-r--r--Zend/tests/use_function/alias.phpt30
-rw-r--r--Zend/tests/use_function/basic.phpt26
-rw-r--r--Zend/tests/use_function/case_insensivity.phpt13
-rw-r--r--Zend/tests/use_function/conditional_function_declaration.phpt17
-rw-r--r--Zend/tests/use_function/conflicting_use.phpt25
-rw-r--r--Zend/tests/use_function/conflicting_use_alias.phpt20
-rw-r--r--Zend/tests/use_function/conflicting_use_const_alias.phpt23
-rw-r--r--Zend/tests/use_function/define_imported.phpt14
-rw-r--r--Zend/tests/use_function/define_imported_before.phpt18
-rw-r--r--Zend/tests/use_function/ignore_constants.phpt23
-rw-r--r--Zend/tests/use_function/includes/foo_bar.php7
-rw-r--r--Zend/tests/use_function/includes/foo_strlen.php7
-rw-r--r--Zend/tests/use_function/includes/global_bar.php5
-rw-r--r--Zend/tests/use_function/includes/global_baz.php4
-rw-r--r--Zend/tests/use_function/no_global_fallback.phpt13
-rw-r--r--Zend/tests/use_function/no_global_fallback2.phpt18
-rw-r--r--Zend/tests/use_function/self_parent.phpt12
-rw-r--r--Zend/tests/use_function/shadow_core.phpt16
-rw-r--r--Zend/tests/use_function/shadow_global.phpt25
-rw-r--r--Zend/tests/variadic/adding_additional_optional_parameter.phpt17
-rw-r--r--Zend/tests/variadic/adding_additional_optional_parameter_error.phpt16
-rw-r--r--Zend/tests/variadic/basic.phpt57
-rw-r--r--Zend/tests/variadic/by_ref.phpt24
-rw-r--r--Zend/tests/variadic/by_ref_error.phpt12
-rw-r--r--Zend/tests/variadic/no_default_error.phpt10
-rw-r--r--Zend/tests/variadic/non_variadic_implements_variadic_error.phpt16
-rw-r--r--Zend/tests/variadic/only_last_error.phpt10
-rw-r--r--Zend/tests/variadic/optional_params.phpt49
-rw-r--r--Zend/tests/variadic/removing_parameter_error.phpt20
-rw-r--r--Zend/tests/variadic/typehint_error.phpt36
-rw-r--r--Zend/tests/variadic/typehint_suppressed_error.phpt33
-rw-r--r--Zend/tests/variadic/variadic_changed_byref_error.phpt16
-rw-r--r--Zend/tests/variadic/variadic_changed_typehint_error.phpt16
-rw-r--r--Zend/tests/variadic/variadic_implements_non_variadic.phpt17
-rw-r--r--Zend/tests/zend_signed_multiply-32bit.phpt14
-rw-r--r--Zend/tests/zend_signed_multiply-64bit.phpt14
68 files changed, 1230 insertions, 3 deletions
diff --git a/Zend/tests/bug30820.phpt b/Zend/tests/bug30820.phpt
index 97e46e9287..a0f71e72a7 100644
--- a/Zend/tests/bug30820.phpt
+++ b/Zend/tests/bug30820.phpt
@@ -2,6 +2,7 @@
Bug #30820 (static member conflict with $this->member silently ignored)
--INI--
error_reporting=4095
+opcache.optimization_level=0
--FILE--
<?php
class Blah {
diff --git a/Zend/tests/bug65784.phpt b/Zend/tests/bug65784.phpt
index adc34113a5..29f086b5e3 100644
--- a/Zend/tests/bug65784.phpt
+++ b/Zend/tests/bug65784.phpt
@@ -1,7 +1,5 @@
--TEST--
Fixed Bug #65784 (Segfault with finally)
---XFAIL--
-This bug is not fixed in 5.5 due to ABI BC
--FILE--
<?php
function foo1() {
diff --git a/Zend/tests/bug66252.phpt b/Zend/tests/bug66252.phpt
new file mode 100644
index 0000000000..e692a8e706
--- /dev/null
+++ b/Zend/tests/bug66252.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #66252 (Problems in AST evaluation invalidating valid parent:: reference)
+--FILE--
+<?php
+class A {
+ const HW = "this is A";
+}
+class B extends A {
+ const BHW = parent::HW . " extended by B";
+}
+const C = B::BHW;
+echo C, "\n";
+--EXPECT--
+this is A extended by B
diff --git a/Zend/tests/class_properties_dynamic.phpt b/Zend/tests/class_properties_dynamic.phpt
new file mode 100644
index 0000000000..8a1fc6f029
--- /dev/null
+++ b/Zend/tests/class_properties_dynamic.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Class Property Expressions
+--FILE--
+<?php
+class Foo {
+ const BAR = 1 << 0;
+ const BAZ = 1 << 1;
+ public $bar = self::BAR | self::BAZ;
+}
+echo (new Foo)->bar;
+?>
+--EXPECTF--
+3
diff --git a/Zend/tests/class_properties_static.phpt b/Zend/tests/class_properties_static.phpt
new file mode 100644
index 0000000000..9a56466340
--- /dev/null
+++ b/Zend/tests/class_properties_static.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Static Class Property Expressions
+--FILE--
+<?php
+class Foo {
+ public $b1 = 1 + 1;
+ public $b2 = 1 << 2;
+ public $b3 = "foo " . " bar " . " baz";
+}
+$f = new Foo;
+var_dump(
+ $f->b1,
+ $f->b2,
+ $f->b3
+);
+?>
+--EXPECT--
+int(2)
+int(4)
+string(13) "foo bar baz"
diff --git a/Zend/tests/closure_018.phpt b/Zend/tests/closure_018.phpt
index d98c78aeac..2dcf15c6aa 100644
--- a/Zend/tests/closure_018.phpt
+++ b/Zend/tests/closure_018.phpt
@@ -21,8 +21,11 @@ var_dump($x = $test->test($y));
var_dump($y, $x);
?>
---EXPECT--
+--EXPECTF--
+Notice: Only variable references should be returned by reference in %sclosure_018.php on line 7
int(4)
+
+Notice: Only variable references should be returned by reference in %sclosure_018.php on line 7
int(16)
int(16)
int(16)
diff --git a/Zend/tests/closure_019.phpt b/Zend/tests/closure_019.phpt
index 0c4c34e163..57aa2dec17 100644
--- a/Zend/tests/closure_019.phpt
+++ b/Zend/tests/closure_019.phpt
@@ -20,7 +20,10 @@ test();
?>
--EXPECTF--
+Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
int(9)
+
+Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
int(81)
Fatal error: Cannot pass parameter 1 by reference in %s on line %d
diff --git a/Zend/tests/constant_expressions.phpt b/Zend/tests/constant_expressions.phpt
new file mode 100644
index 0000000000..7dea0d83f7
--- /dev/null
+++ b/Zend/tests/constant_expressions.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Constant Expressions
+--FILE--
+<?php
+const T_1 = 1 << 1;
+const T_2 = 1 / 2;
+const T_3 = 1.5 + 1.5;
+const T_4 = "foo" . "bar";
+const T_5 = (1.5 + 1.5) * 2;
+const T_6 = "foo" . 2 . 3 . 4.0;
+const T_7 = __LINE__;
+const T_8 = <<<ENDOFSTRING
+This is a test string
+ENDOFSTRING;
+const T_9 = ~-1;
+const T_10 = (-1?:1) + (0?2:3);
+const T_11 = 1 && 0;
+const T_12 = 1 and 1;
+const T_13 = 0 || 0;
+const T_14 = 1 or 0;
+const T_15 = 1 xor 1;
+const T_16 = 1 xor 0;
+const T_17 = 1 < 0;
+const T_18 = 0 <= 0;
+const T_19 = 1 > 0;
+const T_20 = 1 >= 0;
+const T_21 = 1 === 1;
+const T_22 = 1 !== 1;
+const T_23 = 0 != "0";
+const T_24 = 1 == "1";
+
+// Test order of operations
+const T_25 = 1 + 2 * 3;
+
+// Test for memory leaks
+const T_26 = "1" + 2 + "3";
+
+var_dump(T_1);
+var_dump(T_2);
+var_dump(T_3);
+var_dump(T_4);
+var_dump(T_5);
+var_dump(T_6);
+var_dump(T_7);
+var_dump(T_8);
+var_dump(T_9);
+var_dump(T_10);
+var_dump(T_11);
+var_dump(T_12);
+var_dump(T_13);
+var_dump(T_14);
+var_dump(T_15);
+var_dump(T_16);
+var_dump(T_17);
+var_dump(T_18);
+var_dump(T_19);
+var_dump(T_20);
+var_dump(T_21);
+var_dump(T_22);
+var_dump(T_23);
+var_dump(T_24);
+var_dump(T_25);
+var_dump(T_26);
+?>
+--EXPECT--
+int(2)
+float(0.5)
+float(3)
+string(6) "foobar"
+float(6)
+string(6) "foo234"
+int(8)
+string(21) "This is a test string"
+int(0)
+int(2)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+int(7)
+int(6)
diff --git a/Zend/tests/constant_expressions_classes.phpt b/Zend/tests/constant_expressions_classes.phpt
new file mode 100644
index 0000000000..6298ff66d6
--- /dev/null
+++ b/Zend/tests/constant_expressions_classes.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Constant scalar expressions with autoloading and classes
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
+--FILE--
+<?php
+
+# This test validates that autoloading works for common const expression (AST) use cases
+$classlist = [
+ 'A'=> 'class A { const HW = "this is A"; }',
+ 'B'=> 'class B extends A { const HW = parent::HW." extended by B"; }',
+ 'space1\C' => 'namespace space1; class C { const HW = "this is space1\C"; }',
+ 'D' => 'class D { const HW = \space1\C::HW." extented by D"; }',
+ 'trE' => 'trait trE { public static function getHW() { return parent::HW; } }',
+ 'E' => 'class E extends B { use trE; }',
+ 'F' => 'class F { const XX = "this is F"; }',
+ 'G' => 'class G extends F { const XX = parent::XX." extended by G"; public static function get_me($x = "got ".self::XX) { return $x; } }',
+];
+
+spl_autoload_register(function ($class) use ($classlist) {
+ if (isset($classlist[$class])) {
+ eval($classlist[$class]);
+ } else {
+ die("Cannot autoload $class\n");
+ }
+});
+
+printf("B::HW = %s\n", B::HW);
+printf("D::HW = %s\n", D::HW);
+
+printf("E::getHW() = %s\n", E::getHW());
+printf("G::get_me() = %s\n", G::get_me());
+
+?>
+--EXPECT--
+B::HW = this is A extended by B
+D::HW = this is space1\C extented by D
+E::getHW() = this is A extended by B
+G::get_me() = got this is F extended by G
diff --git a/Zend/tests/constant_expressions_dynamic.phpt b/Zend/tests/constant_expressions_dynamic.phpt
new file mode 100644
index 0000000000..21c9216cc1
--- /dev/null
+++ b/Zend/tests/constant_expressions_dynamic.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Dynamic Constant Expressions
+--FILE--
+<?php
+const FOO = 1;
+const BAR = FOO | 2;
+
+echo BAR;
+?>
+--EXPECTF--
+3
diff --git a/Zend/tests/finally_goto_001.phpt b/Zend/tests/finally_goto_001.phpt
new file mode 100644
index 0000000000..990f78d4c7
--- /dev/null
+++ b/Zend/tests/finally_goto_001.phpt
@@ -0,0 +1,14 @@
+--TEST--
+jmp into a finally block 01
+--FILE--
+<?php
+function foo() {
+ goto test;
+ try {
+ } finally {
+test:
+ }
+}
+?>
+--EXPECTF--
+Fatal error: jump into a finally block is disallowed in %sfinally_goto_001.php on line %d
diff --git a/Zend/tests/finally_goto_002.phpt b/Zend/tests/finally_goto_002.phpt
new file mode 100644
index 0000000000..a6bd9e307f
--- /dev/null
+++ b/Zend/tests/finally_goto_002.phpt
@@ -0,0 +1,14 @@
+--TEST--
+jmp into a finally block 02
+--FILE--
+<?php
+function foo() {
+ try {
+ goto test;
+ } finally {
+test:
+ }
+}
+?>
+--EXPECTF--
+Fatal error: jump into a finally block is disallowed in %sfinally_goto_002.php on line %d
diff --git a/Zend/tests/finally_goto_003.phpt b/Zend/tests/finally_goto_003.phpt
new file mode 100644
index 0000000000..8529ff7865
--- /dev/null
+++ b/Zend/tests/finally_goto_003.phpt
@@ -0,0 +1,15 @@
+--TEST--
+jmp into a finally block 03
+--FILE--
+<?php
+function foo() {
+ try {
+ } finally {
+ goto test;
+test:
+ }
+}
+echo "okey";
+?>
+--EXPECTF--
+okey
diff --git a/Zend/tests/finally_goto_004.phpt b/Zend/tests/finally_goto_004.phpt
new file mode 100644
index 0000000000..d88ceedf52
--- /dev/null
+++ b/Zend/tests/finally_goto_004.phpt
@@ -0,0 +1,14 @@
+--TEST--
+jmp into a finally block 03
+--FILE--
+<?php
+function foo() {
+ try {
+ } finally {
+test:
+ }
+ goto test;
+}
+?>
+--EXPECTF--
+Fatal error: jump into a finally block is disallowed in %sfinally_goto_004.php on line %d
diff --git a/Zend/tests/function_arguments_003.phpt b/Zend/tests/function_arguments_003.phpt
new file mode 100644
index 0000000000..b882476d1d
--- /dev/null
+++ b/Zend/tests/function_arguments_003.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Function Argument Parsing #003
+--FILE--
+<?php
+const a = 10;
+
+function t1($a = 1 + 1, $b = 1 << 2, $c = "foo" . "bar", $d = a * 10) {
+ var_dump($a, $b, $c, $d);
+}
+
+t1();
+?>
+--EXPECT--
+int(2)
+int(4)
+string(6) "foobar"
+int(100)
diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt
new file mode 100644
index 0000000000..2d9b59c1e8
--- /dev/null
+++ b/Zend/tests/incompat_ctx_user.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Incompatible context call (non-internal function)
+--INI--
+error_reporting=E_ALL
+--FILE--
+<?php
+
+class A {
+ function foo() { var_dump(get_class($this)); }
+}
+class B {
+ function bar() { A::foo(); }
+}
+$b = new B;
+$b->bar();
+
+?>
+--EXPECTF--
+Deprecated: Non-static method A::foo() should not be called statically, assuming $this from incompatible context in %s on line %d
+string(1) "B"
diff --git a/Zend/tests/static_variable.phpt b/Zend/tests/static_variable.phpt
new file mode 100644
index 0000000000..62ca565ffe
--- /dev/null
+++ b/Zend/tests/static_variable.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Static Variable Expressions
+--FILE--
+<?php
+const bar = 2, baz = bar + 1;
+
+function foo() {
+ static $a = 1 + 1;
+ static $b = [bar => 1 + 1, baz * 2 => 1 << 2];
+ static $c = [1 => bar, 3 => baz];
+ var_dump($a, $b, $c);
+}
+
+foo();
+?>
+--EXPECT--
+int(2)
+array(2) {
+ [2]=>
+ int(2)
+ [6]=>
+ int(4)
+}
+array(2) {
+ [1]=>
+ int(2)
+ [3]=>
+ int(3)
+}
diff --git a/Zend/tests/use_const/alias.phpt b/Zend/tests/use_const/alias.phpt
new file mode 100644
index 0000000000..f179393006
--- /dev/null
+++ b/Zend/tests/use_const/alias.phpt
@@ -0,0 +1,26 @@
+--TEST--
+aliasing imported constants to resolve naming conflicts
+--FILE--
+<?php
+
+namespace foo {
+ const baz = 42;
+}
+
+namespace bar {
+ const baz = 43;
+}
+
+namespace {
+ use const foo\baz as foo_baz,
+ bar\baz as bar_baz;
+ var_dump(foo_baz);
+ var_dump(bar_baz);
+ echo "Done\n";
+}
+
+?>
+--EXPECT--
+int(42)
+int(43)
+Done
diff --git a/Zend/tests/use_const/basic.phpt b/Zend/tests/use_const/basic.phpt
new file mode 100644
index 0000000000..6eaed7f27d
--- /dev/null
+++ b/Zend/tests/use_const/basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+import namespaced constant
+--FILE--
+<?php
+
+namespace foo\bar {
+ const baz = 42;
+ const qux = 43;
+}
+
+namespace {
+ use const foo\bar\baz, foo\bar\qux;
+ var_dump(baz);
+ var_dump(qux);
+ echo "Done\n";
+}
+
+?>
+--EXPECT--
+int(42)
+int(43)
+Done
diff --git a/Zend/tests/use_const/case_sensivity.phpt b/Zend/tests/use_const/case_sensivity.phpt
new file mode 100644
index 0000000000..1977daa93b
--- /dev/null
+++ b/Zend/tests/use_const/case_sensivity.phpt
@@ -0,0 +1,12 @@
+--TEST--
+importing const with same name but different case
+--FILE--
+<?php
+
+namespace {
+ use const foo\bar;
+ use const foo\BAR;
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/use_const/conflicting_use.phpt b/Zend/tests/use_const/conflicting_use.phpt
new file mode 100644
index 0000000000..3b3c4b3262
--- /dev/null
+++ b/Zend/tests/use_const/conflicting_use.phpt
@@ -0,0 +1,21 @@
+--TEST--
+use const statements with conflicting names
+--FILE--
+<?php
+
+namespace foo {
+ const baz = 42;
+}
+
+namespace bar {
+ const baz = 42;
+}
+
+namespace {
+ use const foo\baz, bar\baz;
+ echo "Done\n";
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use const bar\baz as baz because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_const/conflicting_use_alias.phpt b/Zend/tests/use_const/conflicting_use_alias.phpt
new file mode 100644
index 0000000000..8b563a4ca9
--- /dev/null
+++ b/Zend/tests/use_const/conflicting_use_alias.phpt
@@ -0,0 +1,18 @@
+--TEST--
+use and use const with the same alias
+--FILE--
+<?php
+
+namespace {
+ const foo = 'foo';
+}
+
+namespace x {
+ use foo as bar;
+ use const foo as bar;
+ var_dump(bar);
+}
+
+?>
+--EXPECT--
+string(3) "foo"
diff --git a/Zend/tests/use_const/define_imported.phpt b/Zend/tests/use_const/define_imported.phpt
new file mode 100644
index 0000000000..5eb44be64a
--- /dev/null
+++ b/Zend/tests/use_const/define_imported.phpt
@@ -0,0 +1,14 @@
+--TEST--
+defining const with same name as imported should fail
+--FILE--
+<?php
+
+namespace {
+ use const foo\bar;
+
+ const bar = 42;
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare const bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_const/define_imported_before.phpt b/Zend/tests/use_const/define_imported_before.phpt
new file mode 100644
index 0000000000..f674ce81e8
--- /dev/null
+++ b/Zend/tests/use_const/define_imported_before.phpt
@@ -0,0 +1,18 @@
+--TEST--
+using const with same name as defined should fail
+--FILE--
+<?php
+
+namespace {
+ const bar = 42;
+
+ use const foo\bar;
+}
+
+namespace {
+ echo "Done";
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use const foo\bar as bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_const/includes/foo_bar.php b/Zend/tests/use_const/includes/foo_bar.php
new file mode 100644
index 0000000000..90ed451f36
--- /dev/null
+++ b/Zend/tests/use_const/includes/foo_bar.php
@@ -0,0 +1,5 @@
+<?php
+
+namespace foo;
+
+const bar = 'local bar';
diff --git a/Zend/tests/use_const/includes/foo_php_version.php b/Zend/tests/use_const/includes/foo_php_version.php
new file mode 100644
index 0000000000..08f9fd150e
--- /dev/null
+++ b/Zend/tests/use_const/includes/foo_php_version.php
@@ -0,0 +1,5 @@
+<?php
+
+namespace foo;
+
+const PHP_VERSION = 42;
diff --git a/Zend/tests/use_const/includes/global_bar.php b/Zend/tests/use_const/includes/global_bar.php
new file mode 100644
index 0000000000..609d17b7b5
--- /dev/null
+++ b/Zend/tests/use_const/includes/global_bar.php
@@ -0,0 +1,3 @@
+<?php
+
+const bar = 'global bar';
diff --git a/Zend/tests/use_const/includes/global_baz.php b/Zend/tests/use_const/includes/global_baz.php
new file mode 100644
index 0000000000..8b6fba97b3
--- /dev/null
+++ b/Zend/tests/use_const/includes/global_baz.php
@@ -0,0 +1,3 @@
+<?php
+
+const baz = NULL;
diff --git a/Zend/tests/use_const/no_global_fallback.phpt b/Zend/tests/use_const/no_global_fallback.phpt
new file mode 100644
index 0000000000..a128f353ed
--- /dev/null
+++ b/Zend/tests/use_const/no_global_fallback.phpt
@@ -0,0 +1,14 @@
+--TEST--
+non-existent imported constants should not be looked up in the global table
+--FILE--
+<?php
+
+require 'includes/global_baz.php';
+
+use const foo\bar\baz;
+var_dump(baz);
+
+?>
+--EXPECTF--
+Notice: Use of undefined constant baz - assumed 'baz' in %s on line %d
+string(3) "baz"
diff --git a/Zend/tests/use_const/self_parent.phpt b/Zend/tests/use_const/self_parent.phpt
new file mode 100644
index 0000000000..b71f2ecc81
--- /dev/null
+++ b/Zend/tests/use_const/self_parent.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Allow self and parent in use const statement
+--FILE--
+<?php
+
+namespace {
+ use const self as foo;
+ use const parent as bar;
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/use_const/shadow_core.phpt b/Zend/tests/use_const/shadow_core.phpt
new file mode 100644
index 0000000000..7d8bcbd189
--- /dev/null
+++ b/Zend/tests/use_const/shadow_core.phpt
@@ -0,0 +1,16 @@
+--TEST--
+shadowing a global core constant with a local version
+--FILE--
+<?php
+
+require 'includes/foo_php_version.php';
+
+use const foo\PHP_VERSION;
+
+var_dump(PHP_VERSION);
+echo "Done\n";
+
+?>
+--EXPECTF--
+int(42)
+Done
diff --git a/Zend/tests/use_const/shadow_global.phpt b/Zend/tests/use_const/shadow_global.phpt
new file mode 100644
index 0000000000..930cc9f0b8
--- /dev/null
+++ b/Zend/tests/use_const/shadow_global.phpt
@@ -0,0 +1,25 @@
+--TEST--
+shadowing a global constant with a local version
+--FILE--
+<?php
+
+namespace {
+ require 'includes/global_bar.php';
+ require 'includes/foo_bar.php';
+}
+
+namespace {
+ var_dump(bar);
+}
+
+namespace {
+ use const foo\bar;
+ var_dump(bar);
+ echo "Done\n";
+}
+
+?>
+--EXPECT--
+string(10) "global bar"
+string(9) "local bar"
+Done
diff --git a/Zend/tests/use_function/alias.phpt b/Zend/tests/use_function/alias.phpt
new file mode 100644
index 0000000000..5f7e97fff8
--- /dev/null
+++ b/Zend/tests/use_function/alias.phpt
@@ -0,0 +1,30 @@
+--TEST--
+aliasing imported functions to resolve naming conflicts
+--FILE--
+<?php
+
+namespace foo {
+ function baz() {
+ return 'foo.baz';
+ }
+}
+
+namespace bar {
+ function baz() {
+ return 'bar.baz';
+ }
+}
+
+namespace {
+ use function foo\baz as foo_baz,
+ bar\baz as bar_baz;
+ var_dump(foo_baz());
+ var_dump(bar_baz());
+ echo "Done\n";
+}
+
+?>
+--EXPECT--
+string(7) "foo.baz"
+string(7) "bar.baz"
+Done
diff --git a/Zend/tests/use_function/basic.phpt b/Zend/tests/use_function/basic.phpt
new file mode 100644
index 0000000000..513a96620c
--- /dev/null
+++ b/Zend/tests/use_function/basic.phpt
@@ -0,0 +1,26 @@
+--TEST--
+import namespaced function
+--FILE--
+<?php
+
+namespace foo\bar {
+ function baz() {
+ return 'foo.bar.baz';
+ }
+ function qux() {
+ return baz();
+ }
+}
+
+namespace {
+ use function foo\bar\baz, foo\bar\qux;
+ var_dump(baz());
+ var_dump(qux());
+ echo "Done\n";
+}
+
+?>
+--EXPECT--
+string(11) "foo.bar.baz"
+string(11) "foo.bar.baz"
+Done
diff --git a/Zend/tests/use_function/case_insensivity.phpt b/Zend/tests/use_function/case_insensivity.phpt
new file mode 100644
index 0000000000..ba6e3a7e4b
--- /dev/null
+++ b/Zend/tests/use_function/case_insensivity.phpt
@@ -0,0 +1,13 @@
+--TEST--
+importing function with same name but different case should fail
+--FILE--
+<?php
+
+namespace {
+ use function foo\bar;
+ use function foo\BAR;
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use function foo\BAR as BAR because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_function/conditional_function_declaration.phpt b/Zend/tests/use_function/conditional_function_declaration.phpt
new file mode 100644
index 0000000000..ccfb96103a
--- /dev/null
+++ b/Zend/tests/use_function/conditional_function_declaration.phpt
@@ -0,0 +1,17 @@
+--TEST--
+function that is conditionally defined at runtime should not cause compiler error
+--FILE--
+<?php
+
+if (0) {
+ function foo() {
+ }
+}
+
+use function bar\foo;
+
+echo "Done";
+
+?>
+--EXPECT--
+Done
diff --git a/Zend/tests/use_function/conflicting_use.phpt b/Zend/tests/use_function/conflicting_use.phpt
new file mode 100644
index 0000000000..0221fbdebb
--- /dev/null
+++ b/Zend/tests/use_function/conflicting_use.phpt
@@ -0,0 +1,25 @@
+--TEST--
+use function statements with conflicting names
+--FILE--
+<?php
+
+namespace foo {
+ function baz() {
+ return 'foo.baz';
+ }
+}
+
+namespace bar {
+ function baz() {
+ return 'bar.baz';
+ }
+}
+
+namespace {
+ use function foo\baz, bar\baz;
+ echo "Done\n";
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use function bar\baz as baz because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_function/conflicting_use_alias.phpt b/Zend/tests/use_function/conflicting_use_alias.phpt
new file mode 100644
index 0000000000..2870512014
--- /dev/null
+++ b/Zend/tests/use_function/conflicting_use_alias.phpt
@@ -0,0 +1,20 @@
+--TEST--
+use and use function with the same alias
+--FILE--
+<?php
+
+namespace {
+ function foo() {
+ return 'foo';
+ }
+}
+
+namespace x {
+ use foo as bar;
+ use function foo as bar;
+ var_dump(bar());
+}
+
+?>
+--EXPECT--
+string(3) "foo"
diff --git a/Zend/tests/use_function/conflicting_use_const_alias.phpt b/Zend/tests/use_function/conflicting_use_const_alias.phpt
new file mode 100644
index 0000000000..2e0faf0da2
--- /dev/null
+++ b/Zend/tests/use_function/conflicting_use_const_alias.phpt
@@ -0,0 +1,23 @@
+--TEST--
+use const and use function with the same alias
+--FILE--
+<?php
+
+namespace {
+ const foo = 'foo.const';
+ function foo() {
+ return 'foo.function';
+ }
+}
+
+namespace x {
+ use const foo as bar;
+ use function foo as bar;
+ var_dump(bar);
+ var_dump(bar());
+}
+
+?>
+--EXPECT--
+string(9) "foo.const"
+string(12) "foo.function"
diff --git a/Zend/tests/use_function/define_imported.phpt b/Zend/tests/use_function/define_imported.phpt
new file mode 100644
index 0000000000..c542a4d549
--- /dev/null
+++ b/Zend/tests/use_function/define_imported.phpt
@@ -0,0 +1,14 @@
+--TEST--
+defining function with same name as imported should fail
+--FILE--
+<?php
+
+namespace {
+ use function foo\bar;
+
+ function bar() {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare function bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_function/define_imported_before.phpt b/Zend/tests/use_function/define_imported_before.phpt
new file mode 100644
index 0000000000..91974e0783
--- /dev/null
+++ b/Zend/tests/use_function/define_imported_before.phpt
@@ -0,0 +1,18 @@
+--TEST--
+using function with same name as defined should fail
+--FILE--
+<?php
+
+namespace {
+ function bar() {}
+
+ use function foo\bar;
+}
+
+namespace {
+ echo "Done";
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use function foo\bar as bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/use_function/ignore_constants.phpt b/Zend/tests/use_function/ignore_constants.phpt
new file mode 100644
index 0000000000..c50ff7357a
--- /dev/null
+++ b/Zend/tests/use_function/ignore_constants.phpt
@@ -0,0 +1,23 @@
+--TEST--
+use function should ignore namespaced constants
+--FILE--
+<?php
+
+namespace foo {
+ const bar = 42;
+}
+
+namespace {
+ const bar = 43;
+}
+
+namespace {
+ use function foo\bar;
+ var_dump(bar);
+ echo "Done\n";
+}
+
+?>
+--EXPECT--
+int(43)
+Done
diff --git a/Zend/tests/use_function/includes/foo_bar.php b/Zend/tests/use_function/includes/foo_bar.php
new file mode 100644
index 0000000000..6d2f8cab45
--- /dev/null
+++ b/Zend/tests/use_function/includes/foo_bar.php
@@ -0,0 +1,7 @@
+<?php
+
+namespace foo;
+
+function bar() {
+ return 'local bar';
+}
diff --git a/Zend/tests/use_function/includes/foo_strlen.php b/Zend/tests/use_function/includes/foo_strlen.php
new file mode 100644
index 0000000000..d2df2aa2b4
--- /dev/null
+++ b/Zend/tests/use_function/includes/foo_strlen.php
@@ -0,0 +1,7 @@
+<?php
+
+namespace foo;
+
+function strlen($str) {
+ return 4;
+}
diff --git a/Zend/tests/use_function/includes/global_bar.php b/Zend/tests/use_function/includes/global_bar.php
new file mode 100644
index 0000000000..6d7d91f805
--- /dev/null
+++ b/Zend/tests/use_function/includes/global_bar.php
@@ -0,0 +1,5 @@
+<?php
+
+function bar() {
+ return 'global bar';
+}
diff --git a/Zend/tests/use_function/includes/global_baz.php b/Zend/tests/use_function/includes/global_baz.php
new file mode 100644
index 0000000000..6383b9dd38
--- /dev/null
+++ b/Zend/tests/use_function/includes/global_baz.php
@@ -0,0 +1,4 @@
+<?php
+
+function baz() {
+}
diff --git a/Zend/tests/use_function/no_global_fallback.phpt b/Zend/tests/use_function/no_global_fallback.phpt
new file mode 100644
index 0000000000..6597d0d301
--- /dev/null
+++ b/Zend/tests/use_function/no_global_fallback.phpt
@@ -0,0 +1,13 @@
+--TEST--
+non-existent imported functions should not be looked up in the global table
+--FILE--
+<?php
+
+require 'includes/global_baz.php';
+
+use function foo\bar\baz;
+var_dump(baz());
+
+?>
+--EXPECTF--
+Fatal error: Call to undefined function foo\bar\baz() in %s on line %d
diff --git a/Zend/tests/use_function/no_global_fallback2.phpt b/Zend/tests/use_function/no_global_fallback2.phpt
new file mode 100644
index 0000000000..5d012c10e5
--- /dev/null
+++ b/Zend/tests/use_function/no_global_fallback2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+non-existent imported functions should not be looked up in the global table
+--FILE--
+<?php
+
+namespace {
+ function test() {
+ echo "NO!";
+ }
+}
+namespace foo {
+ use function bar\test;
+ test();
+}
+
+?>
+--EXPECTF--
+Fatal error: Call to undefined function bar\test() in %s on line %d
diff --git a/Zend/tests/use_function/self_parent.phpt b/Zend/tests/use_function/self_parent.phpt
new file mode 100644
index 0000000000..f1e1fa84f1
--- /dev/null
+++ b/Zend/tests/use_function/self_parent.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Allow self and parent in use function statement
+--FILE--
+<?php
+
+namespace {
+ use function self as foo;
+ use function parent as bar;
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/use_function/shadow_core.phpt b/Zend/tests/use_function/shadow_core.phpt
new file mode 100644
index 0000000000..8f92ff1e1b
--- /dev/null
+++ b/Zend/tests/use_function/shadow_core.phpt
@@ -0,0 +1,16 @@
+--TEST--
+shadowing a global core function with a local version
+--FILE--
+<?php
+
+require 'includes/foo_strlen.php';
+
+use function foo\strlen;
+
+var_dump(strlen('foo bar baz'));
+echo "Done\n";
+
+?>
+--EXPECT--
+int(4)
+Done
diff --git a/Zend/tests/use_function/shadow_global.phpt b/Zend/tests/use_function/shadow_global.phpt
new file mode 100644
index 0000000000..791bcdf4d5
--- /dev/null
+++ b/Zend/tests/use_function/shadow_global.phpt
@@ -0,0 +1,25 @@
+--TEST--
+shadowing a global function with a local version
+--FILE--
+<?php
+
+namespace {
+ require 'includes/global_bar.php';
+ require 'includes/foo_bar.php';
+}
+
+namespace {
+ var_dump(bar());
+}
+
+namespace {
+ use function foo\bar;
+ var_dump(bar());
+ echo "Done\n";
+}
+
+?>
+--EXPECT--
+string(10) "global bar"
+string(9) "local bar"
+Done
diff --git a/Zend/tests/variadic/adding_additional_optional_parameter.phpt b/Zend/tests/variadic/adding_additional_optional_parameter.phpt
new file mode 100644
index 0000000000..b4e797803d
--- /dev/null
+++ b/Zend/tests/variadic/adding_additional_optional_parameter.phpt
@@ -0,0 +1,17 @@
+--TEST--
+It's possible to add additional optional arguments with matching signature
+--FILE--
+<?php
+
+interface DB {
+ public function query($query, string ...$params);
+}
+
+class MySQL implements DB {
+ public function query($query, string $extraParam = null, string ...$params) { }
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt b/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt
new file mode 100644
index 0000000000..2f31d47dc6
--- /dev/null
+++ b/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Additional optional parameters must have a matching prototype
+--FILE--
+<?php
+
+interface DB {
+ public function query($query, string ...$params);
+}
+
+class MySQL implements DB {
+ public function query($query, int $extraParam = null, string ...$params) { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, string ...$params) in %s on line %d
diff --git a/Zend/tests/variadic/basic.phpt b/Zend/tests/variadic/basic.phpt
new file mode 100644
index 0000000000..810d4756aa
--- /dev/null
+++ b/Zend/tests/variadic/basic.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Basic variadic function
+--FILE--
+<?php
+
+function test1(... $args) {
+ var_dump($args);
+}
+
+test1();
+test1(1);
+test1(1, 2, 3);
+
+function test2($arg1, $arg2, ...$args) {
+ var_dump($arg1, $arg2, $args);
+}
+
+test2(1, 2);
+test2(1, 2, 3);
+test2(1, 2, 3, 4, 5);
+
+?>
+--EXPECT--
+array(0) {
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+int(1)
+int(2)
+array(0) {
+}
+int(1)
+int(2)
+array(1) {
+ [0]=>
+ int(3)
+}
+int(1)
+int(2)
+array(3) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ [2]=>
+ int(5)
+}
diff --git a/Zend/tests/variadic/by_ref.phpt b/Zend/tests/variadic/by_ref.phpt
new file mode 100644
index 0000000000..e1635f4ecf
--- /dev/null
+++ b/Zend/tests/variadic/by_ref.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Variadic arguments with by-reference passing
+--FILE--
+<?php
+
+function test(&... $args) {
+ $i = 0;
+ foreach ($args as &$arg) {
+ $arg = $i++;
+ }
+}
+
+test();
+test($a);
+var_dump($a);
+test($b, $c, $d);
+var_dump($b, $c, $d);
+
+?>
+--EXPECT--
+int(0)
+int(0)
+int(1)
+int(2)
diff --git a/Zend/tests/variadic/by_ref_error.phpt b/Zend/tests/variadic/by_ref_error.phpt
new file mode 100644
index 0000000000..7f21014146
--- /dev/null
+++ b/Zend/tests/variadic/by_ref_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+By-ref variadics enforce the reference
+--FILE--
+<?php
+
+function test(&... $args) { }
+
+test(1);
+
+?>
+--EXPECTF--
+Fatal error: Only variables can be passed by reference in %s on line %d
diff --git a/Zend/tests/variadic/no_default_error.phpt b/Zend/tests/variadic/no_default_error.phpt
new file mode 100644
index 0000000000..427ebed028
--- /dev/null
+++ b/Zend/tests/variadic/no_default_error.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Variadic argument cannot have a default value
+--FILE--
+<?php
+
+function test(...$args = 123) {}
+
+?>
+--EXPECTF--
+Fatal error: Variadic parameter cannot have a default value in %s on line %d
diff --git a/Zend/tests/variadic/non_variadic_implements_variadic_error.phpt b/Zend/tests/variadic/non_variadic_implements_variadic_error.phpt
new file mode 100644
index 0000000000..f447837ca4
--- /dev/null
+++ b/Zend/tests/variadic/non_variadic_implements_variadic_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+It's not possible to turn a variadic function into a non-variadic one
+--FILE--
+<?php
+
+interface DB {
+ public function query($query, ...$params);
+}
+
+class MySQL implements DB {
+ public function query($query, $params) { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, ...$params) in %s on line %d
diff --git a/Zend/tests/variadic/only_last_error.phpt b/Zend/tests/variadic/only_last_error.phpt
new file mode 100644
index 0000000000..ee6ff3f777
--- /dev/null
+++ b/Zend/tests/variadic/only_last_error.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Only the last argument can be variadic
+--FILE--
+<?php
+
+function test($foo, ...$bar, $baz) {}
+
+?>
+--EXPECTF--
+Fatal error: Only the last parameter can be variadic in %s on line %d
diff --git a/Zend/tests/variadic/optional_params.phpt b/Zend/tests/variadic/optional_params.phpt
new file mode 100644
index 0000000000..ba965e538c
--- /dev/null
+++ b/Zend/tests/variadic/optional_params.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Optional parameter before variadic parameter
+--FILE--
+<?php
+
+function fn($reqParam, $optParam = null, ...$params) {
+ var_dump($reqParam, $optParam, $params);
+}
+
+fn(1);
+fn(1, 2);
+fn(1, 2, 3);
+fn(1, 2, 3, 4);
+fn(1, 2, 3, 4, 5);
+
+?>
+--EXPECT--
+int(1)
+NULL
+array(0) {
+}
+int(1)
+int(2)
+array(0) {
+}
+int(1)
+int(2)
+array(1) {
+ [0]=>
+ int(3)
+}
+int(1)
+int(2)
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+int(1)
+int(2)
+array(3) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ [2]=>
+ int(5)
+}
diff --git a/Zend/tests/variadic/removing_parameter_error.phpt b/Zend/tests/variadic/removing_parameter_error.phpt
new file mode 100644
index 0000000000..a189e5cf09
--- /dev/null
+++ b/Zend/tests/variadic/removing_parameter_error.phpt
@@ -0,0 +1,20 @@
+--TEST--
+It's not possible to remove required parameter before a variadic parameter
+--FILE--
+<?php
+
+/* Theoretically this should be valid because it weakens the constraint, but
+ * PHP does not allow this (for non-variadics), so I'm not allowing it here, too,
+ * to stay consistent. */
+
+interface DB {
+ public function query($query, ...$params);
+}
+
+class MySQL implements DB {
+ public function query(...$params) { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, ...$params) in %s on line %d
diff --git a/Zend/tests/variadic/typehint_error.phpt b/Zend/tests/variadic/typehint_error.phpt
new file mode 100644
index 0000000000..3006b99957
--- /dev/null
+++ b/Zend/tests/variadic/typehint_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Variadic arguments enforce typehints
+--FILE--
+<?php
+
+function test(array... $args) {
+ var_dump($args);
+}
+
+test();
+test([0], [1], [2]);
+test([0], [1], 2);
+
+?>
+--EXPECTF--
+array(0) {
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+
+Catchable fatal error: Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d
diff --git a/Zend/tests/variadic/typehint_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt
new file mode 100644
index 0000000000..5048e1c1bb
--- /dev/null
+++ b/Zend/tests/variadic/typehint_suppressed_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Error suppression for typehints on variadic arguments works
+--FILE--
+<?php
+
+function test(array... $args) {
+ var_dump($args);
+}
+
+set_error_handler(function($errno, $errstr) {
+ var_dump($errstr);
+ return true;
+});
+
+test([0], [1], 2);
+
+?>
+--EXPECTF--
+string(%d) "Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d and defined"
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [2]=>
+ int(2)
+}
diff --git a/Zend/tests/variadic/variadic_changed_byref_error.phpt b/Zend/tests/variadic/variadic_changed_byref_error.phpt
new file mode 100644
index 0000000000..14fb6ae5eb
--- /dev/null
+++ b/Zend/tests/variadic/variadic_changed_byref_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Variadic arguments must have compatible passing modes
+--FILE--
+<?php
+
+interface DB {
+ public function query($query, &...$params);
+}
+
+class MySQL implements DB {
+ public function query($query, ...$params) { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, &...$params) in %s on line %d
diff --git a/Zend/tests/variadic/variadic_changed_typehint_error.phpt b/Zend/tests/variadic/variadic_changed_typehint_error.phpt
new file mode 100644
index 0000000000..00df33a042
--- /dev/null
+++ b/Zend/tests/variadic/variadic_changed_typehint_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Typehints for variadic arguments have to be compatible
+--FILE--
+<?php
+
+interface DB {
+ public function query($query, string ...$params);
+}
+
+class MySQL implements DB {
+ public function query($query, int ...$params) { }
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of MySQL::query() must be compatible with DB::query($query, string ...$params) in %s on line %d
diff --git a/Zend/tests/variadic/variadic_implements_non_variadic.phpt b/Zend/tests/variadic/variadic_implements_non_variadic.phpt
new file mode 100644
index 0000000000..a66ec280b8
--- /dev/null
+++ b/Zend/tests/variadic/variadic_implements_non_variadic.phpt
@@ -0,0 +1,17 @@
+--TEST--
+A non-variadic function can be turned into a variadic one
+--FILE--
+<?php
+
+interface DB {
+ public function query($query);
+}
+
+class MySQL implements DB {
+ public function query($query, ...$params) { }
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/zend_signed_multiply-32bit.phpt b/Zend/tests/zend_signed_multiply-32bit.phpt
new file mode 100644
index 0000000000..3f37cbac19
--- /dev/null
+++ b/Zend/tests/zend_signed_multiply-32bit.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Zend signed multiply 32-bit
+--SKIPIF--
+<?php if ((1 << 31) > 0) print "skip Running on 64-bit target"; ?>
+--FILE--
+<?php
+var_dump(0x8000 * -0xffff);
+var_dump(0x8001 * 0xfffe);
+var_dump(0x8001 * -0xffff);
+?>
+--EXPECTF--
+int(-2147450880)
+int(2147483646)
+float(-2147516415)
diff --git a/Zend/tests/zend_signed_multiply-64bit.phpt b/Zend/tests/zend_signed_multiply-64bit.phpt
new file mode 100644
index 0000000000..94a6e035fa
--- /dev/null
+++ b/Zend/tests/zend_signed_multiply-64bit.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Zend signed multiply 64-bit
+--SKIPIF--
+<?php if ((1 << 31) < 0) print "skip Running on 32-bit target"; ?>
+--FILE--
+<?php
+var_dump(0x80000000 * -0xffffffff);
+var_dump(0x80000001 * 0xfffffffe);
+var_dump(0x80000001 * -0xffffffff);
+?>
+--EXPECTF--
+int(-9223372034707292160)
+int(9223372036854775806)
+float(-9.2233720390023E+18)