diff options
Diffstat (limited to 'Zend/tests')
28 files changed, 818 insertions, 72 deletions
diff --git a/Zend/tests/class_constants_005.phpt b/Zend/tests/class_constants_005.phpt new file mode 100644 index 0000000000..de53c2c0ca --- /dev/null +++ b/Zend/tests/class_constants_005.phpt @@ -0,0 +1,12 @@ +--TEST-- +String interning during constants substitution +--INI-- +opcache.enable_cli=0 +--FILE-- +<?php +define ("A", "." . ord(26) . "."); +eval("class A {const a = A;}"); +var_dump(A::a); +?> +--EXPECT-- +string(4) ".50." diff --git a/Zend/tests/function_arguments/call_with_leading_comma_error.phpt b/Zend/tests/function_arguments/call_with_leading_comma_error.phpt new file mode 100644 index 0000000000..1f587dd8f5 --- /dev/null +++ b/Zend/tests/function_arguments/call_with_leading_comma_error.phpt @@ -0,0 +1,8 @@ +--TEST-- +Leading commas in function calls is not allowed +--FILE-- +<?php +foo(,$foo); +?> +--EXPECTF-- +Parse error: syntax error, unexpected ',' in %s on line %d diff --git a/Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt b/Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt new file mode 100644 index 0000000000..d8250536da --- /dev/null +++ b/Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt @@ -0,0 +1,8 @@ +--TEST-- +Multiple inner commas in function calls is not allowed +--FILE-- +<?php +foo($foo,,$bar); +?> +--EXPECTF-- +Parse error: syntax error, unexpected ',', expecting ')' in %s on line %d diff --git a/Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt b/Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt new file mode 100644 index 0000000000..a38a01644b --- /dev/null +++ b/Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt @@ -0,0 +1,8 @@ +--TEST-- +Multiple trailing commas in function calls is not allowed +--FILE-- +<?php +foo($foo,,); +?> +--EXPECTF-- +Parse error: syntax error, unexpected ',', expecting ')' in %s on line %d diff --git a/Zend/tests/function_arguments/call_with_only_comma_error.phpt b/Zend/tests/function_arguments/call_with_only_comma_error.phpt new file mode 100644 index 0000000000..8a0ce6810d --- /dev/null +++ b/Zend/tests/function_arguments/call_with_only_comma_error.phpt @@ -0,0 +1,8 @@ +--TEST-- +Single comma in function calls is not allowed +--FILE-- +<?php +foo(,); +?> +--EXPECTF-- +Parse error: syntax error, unexpected ',' in %s on line %d diff --git a/Zend/tests/function_arguments/call_with_trailing_comma_basic.phpt b/Zend/tests/function_arguments/call_with_trailing_comma_basic.phpt new file mode 100644 index 0000000000..f6a7603790 --- /dev/null +++ b/Zend/tests/function_arguments/call_with_trailing_comma_basic.phpt @@ -0,0 +1,97 @@ +--TEST-- +Allow trailing commas in function and method calls +--FILE-- +<?php +function foo(...$args) { + echo __FUNCTION__ . "\n"; + var_dump($args); +} +foo( + 'function', + 'bar', +); + +class Foo +{ + public function __construct(...$args) { + echo __FUNCTION__ . "\n"; + var_dump($args); + } + + public function bar(...$args) { + echo __FUNCTION__ . "\n"; + var_dump($args); + } + + public function __invoke(...$args) { + echo __FUNCTION__ . "\n"; + var_dump($args); + } +} + +$foo = new Foo( + 'constructor', + 'bar', +); + +$foo->bar( + 'method', + 'bar', +); + +$foo( + 'invoke', + 'bar', +); + +$bar = function(...$args) { + echo __FUNCTION__ . "\n"; + var_dump($args); +}; + +$bar( + 'closure', + 'bar', +); + +# Make sure to hit the "not really a function" language constructs +unset($foo, $bar,); +var_dump(isset($foo, $bar,)); +?> +--EXPECT-- +foo +array(2) { + [0]=> + string(8) "function" + [1]=> + string(3) "bar" +} +__construct +array(2) { + [0]=> + string(11) "constructor" + [1]=> + string(3) "bar" +} +bar +array(2) { + [0]=> + string(6) "method" + [1]=> + string(3) "bar" +} +__invoke +array(2) { + [0]=> + string(6) "invoke" + [1]=> + string(3) "bar" +} +{closure} +array(2) { + [0]=> + string(7) "closure" + [1]=> + string(3) "bar" +} +bool(false) diff --git a/Zend/tests/gc_029.phpt b/Zend/tests/gc_029.phpt index 3873d8becd..215d0e0e3b 100644 --- a/Zend/tests/gc_029.phpt +++ b/Zend/tests/gc_029.phpt @@ -1,7 +1,5 @@ --TEST-- GC 029: GC and destructors ---SKIPIF-- -<?php if (PHP_ZTS) { print "skip only for no-zts build"; } --INI-- zend.enable_gc=1 --FILE-- diff --git a/Zend/tests/gc_029_zts.phpt b/Zend/tests/gc_029_zts.phpt deleted file mode 100644 index 5d16e83348..0000000000 --- a/Zend/tests/gc_029_zts.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -GC 029: GC and destructors ---SKIPIF-- -<?php if (!PHP_ZTS) { print "skip only for zts build"; } ---INI-- -zend.enable_gc=1 ---FILE-- -<?php -class Foo { - public $bar; - public $x = array(1,2,3); - function __destruct() { - if ($this->bar !== null) { - $this->x = null; - unset($this->bar); - } - } -} -class Bar { - public $foo; - function __destruct() { - if ($this->foo !== null) { - unset($this->foo); - } - } - -} -$foo = new Foo(); -$bar = new Bar(); -$foo->bar = $bar; -$bar->foo = $foo; -unset($foo); -unset($bar); -var_dump(gc_collect_cycles()); -?> ---EXPECT-- -int(6) diff --git a/Zend/tests/gc_032.phpt b/Zend/tests/gc_032.phpt index cd30ed7cb6..90c30f7c16 100644 --- a/Zend/tests/gc_032.phpt +++ b/Zend/tests/gc_032.phpt @@ -7,35 +7,25 @@ zend.enable_gc=1 $a = array(); $b =& $a; $a[0] = $a; -debug_zval_dump($a); +var_dump($a); $a = array(array()); $b =& $a; $a[0][0] = $a; -debug_zval_dump($a); +var_dump($a); ?> ---EXPECTF-- -array(1) refcount(%d){ +--EXPECT-- +array(1) { [0]=> - array(1) refcount(%d){ - [0]=> - array(1) refcount(%d){ - [0]=> - *RECURSION* - } + array(0) { } } -array(1) refcount(%d){ +array(1) { [0]=> - array(1) refcount(%d){ + array(1) { [0]=> - array(1) refcount(%d){ + array(1) { [0]=> - array(1) refcount(%d){ - [0]=> - array(1) refcount(%d){ - [0]=> - *RECURSION* - } + array(0) { } } } diff --git a/Zend/tests/gc_036.phpt b/Zend/tests/gc_036.phpt new file mode 100644 index 0000000000..67f9a45465 --- /dev/null +++ b/Zend/tests/gc_036.phpt @@ -0,0 +1,19 @@ +--TEST-- +GC 036: Memleaks in self-referenced array +--INI-- +zend.enable_gc = 1 +--FILE-- +<?php +function &foo() { + $a = []; + $a[] =& $a; + return $a; +} +function bar() { + gc_collect_cycles(); +} +bar(foo()); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/list/list_reference_001.phpt b/Zend/tests/list/list_reference_001.phpt new file mode 100644 index 0000000000..a173c7103e --- /dev/null +++ b/Zend/tests/list/list_reference_001.phpt @@ -0,0 +1,88 @@ +--TEST-- +"Reference Unpacking - General" list() +--FILE-- +<?php +$arr = array(1, array(2)); +list(&$a, list(&$b)) = $arr; +var_dump($a, $b); +var_dump($arr); + +$arr = array(1, array(2)); +list($a, &$b) = $arr; +var_dump($arr); + +$arr = array(1, array(2)); +[&$a, [&$b]] = $arr; +var_dump($a, $b); +var_dump($arr); + +$arr = array(1, array(2)); +[&$a, [&$b], &$c] = $arr; +var_dump($a, $b, $c); +var_dump($arr); + +$arr = array("one" => 1, "two" => array(2)); +["one" => &$a, "two" => [&$b], "three" => &$c] = $arr; +var_dump($a, $b, $c); +var_dump($arr); +?> +--EXPECTF-- +int(1) +int(2) +array(2) { + [0]=> + &int(1) + [1]=> + array(1) { + [0]=> + &int(2) + } +} +array(2) { + [0]=> + int(1) + [1]=> + &array(1) { + [0]=> + int(2) + } +} +int(1) +int(2) +array(2) { + [0]=> + &int(1) + [1]=> + array(1) { + [0]=> + &int(2) + } +} +int(1) +int(2) +NULL +array(3) { + [0]=> + &int(1) + [1]=> + array(1) { + [0]=> + &int(2) + } + [2]=> + &NULL +} +int(1) +int(2) +NULL +array(3) { + ["one"]=> + &int(1) + ["two"]=> + array(1) { + [0]=> + &int(2) + } + ["three"]=> + &NULL +} diff --git a/Zend/tests/list/list_reference_002.phpt b/Zend/tests/list/list_reference_002.phpt new file mode 100644 index 0000000000..32aad686d1 --- /dev/null +++ b/Zend/tests/list/list_reference_002.phpt @@ -0,0 +1,20 @@ +--TEST-- +"Reference Unpacking - New Reference" list() +--FILE-- +<?php +$arr = array(new stdclass); +list(&$a, &$b) = $arr; +var_dump($a, $b); +var_dump($arr); +?> +--EXPECTF-- +object(stdClass)#%d (0) { +} +NULL +array(2) { + [0]=> + &object(stdClass)#%d (0) { + } + [1]=> + &NULL +} diff --git a/Zend/tests/list/list_reference_003.phpt b/Zend/tests/list/list_reference_003.phpt new file mode 100644 index 0000000000..9c903407d5 --- /dev/null +++ b/Zend/tests/list/list_reference_003.phpt @@ -0,0 +1,73 @@ +--TEST-- +"Reference Unpacking - From Functions" list() +--FILE-- +<?php +$arr = [1, 2]; +function no_ref($a) { + return $a; +} + +function no_ref_by_ref(&$a) { + return $a; +} + +function &ref_return(&$a) { + return $a; +} + +function &ref_return_global() { + global $arr; + return $arr; +} + +$a = [1, 2]; +[&$var] = no_ref($a); +var_dump($var); +var_dump($a); + +$a = [1, 2]; +[&$var] = no_ref_by_ref($a); +var_dump($var); +var_dump($a); + +$a = [1, 2]; +[&$var] = ref_return($a); +var_dump($var); +var_dump($a); + +[,&$var] = ref_return_global(); +var_dump($var); +var_dump($arr); +?> +--EXPECTF-- +Notice: Attempting to set reference to non referenceable value in %s on line %d +int(1) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} + +Notice: Attempting to set reference to non referenceable value in %s on line %d +int(1) +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +int(1) +array(2) { + [0]=> + &int(1) + [1]=> + int(2) +} +int(2) +array(2) { + [0]=> + int(1) + [1]=> + &int(2) +} diff --git a/Zend/tests/list/list_reference_004.phpt b/Zend/tests/list/list_reference_004.phpt new file mode 100644 index 0000000000..fc9955e28a --- /dev/null +++ b/Zend/tests/list/list_reference_004.phpt @@ -0,0 +1,28 @@ +--TEST-- +"Reference Unpacking - Foreach" list() +--FILE-- +<?php +$coords = array(array(1, 2), array(3, 4)); +foreach ($coords as [&$x, $y]) { + $x++; + $y++; +} +var_dump($coords); +?> +--EXPECTF-- +array(2) { + [0]=> + array(2) { + [0]=> + int(2) + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + &int(4) + [1]=> + int(4) + } +} diff --git a/Zend/tests/list/list_reference_005.phpt b/Zend/tests/list/list_reference_005.phpt new file mode 100644 index 0000000000..397f9013b5 --- /dev/null +++ b/Zend/tests/list/list_reference_005.phpt @@ -0,0 +1,73 @@ +--TEST-- +"Reference Unpacking - Class Property and Methods" list() +--FILE-- +<?php +class A { + public $a = [['hello']]; + public $b = ['world']; + + public function getVar() { + return $this->a; + } + + public function &getVarRef() { + return $this->a; + } +} + +class B { + static $a = [['world']]; +} + +$a = new A(); +[&$var] = $a->a; +[&$var_too] = $a->b; +var_dump($a->a); +var_dump($a->b); + +$a = new A(); +[&$var] = $a->getVar(); +var_dump($a->a); + +$a = new A(); +[&$var] = $a->getVarRef(); +var_dump($a->a); + +[&$var] = B::$a; +var_dump(B::$a); +?> +--EXPECTF-- +array(1) { + [0]=> + &array(1) { + [0]=> + string(5) "hello" + } +} +array(1) { + [0]=> + &string(5) "world" +} + +Notice: Attempting to set reference to non referenceable value in %s on line %d +array(1) { + [0]=> + array(1) { + [0]=> + string(5) "hello" + } +} +array(1) { + [0]=> + &array(1) { + [0]=> + string(5) "hello" + } +} +array(1) { + [0]=> + &array(1) { + [0]=> + string(5) "world" + } +} diff --git a/Zend/tests/list/list_reference_006.phpt b/Zend/tests/list/list_reference_006.phpt new file mode 100644 index 0000000000..f85edf04a4 --- /dev/null +++ b/Zend/tests/list/list_reference_006.phpt @@ -0,0 +1,58 @@ +--TEST-- +"Reference Unpacking - Class ArrayAccess No Reference" list() +--FILE-- +<?php +class StorageNoRef implements ArrayAccess { + private $s = []; + function __construct(array $a) { $this->s = $a; } + function offsetSet ($k, $v) { $this->s[$k] = $v; } + function offsetGet ($k) { return $this->s[$k]; } + function offsetExists ($k) { return isset($this->s[$k]); } + function offsetUnset ($k) { unset($this->s[$k]); } +} + +$a = new StorageNoRef([1, 2]); +list(&$one, $two) = $a; +var_dump($a); + +$a = new StorageNoRef([1, 2]); +list(,,list($var)) = $a; +var_dump($a); + +$a = new StorageNoRef(['one' => 1, 'two' => 2]); +['one' => &$one, 'two' => $two] = $a; +var_dump($a); +?> +--EXPECTF-- +Notice: Indirect modification of overloaded element of %s has no effect in %s on line %d +object(StorageNoRef)#1 (1) { + ["s":"StorageNoRef":private]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +Notice: Undefined offset: 2 in %s on line %d +object(StorageNoRef)#2 (1) { + ["s":"StorageNoRef":private]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} + +Notice: Indirect modification of overloaded element of %s has no effect in %s on line %d +object(StorageNoRef)#1 (1) { + ["s":"StorageNoRef":private]=> + array(2) { + ["one"]=> + int(1) + ["two"]=> + int(2) + } +} diff --git a/Zend/tests/list/list_reference_007.phpt b/Zend/tests/list/list_reference_007.phpt new file mode 100644 index 0000000000..51f1cac496 --- /dev/null +++ b/Zend/tests/list/list_reference_007.phpt @@ -0,0 +1,75 @@ +--TEST-- +"Reference Unpacking - Class ArrayAccess With Reference" list() +--FILE-- +<?php + +class StorageRef implements ArrayAccess { + private $s = []; + function __construct(array $a) { $this->s = $a; } + function offsetSet ($k, $v) { $this->s[$k] = $v; } + function &offsetGet ($k) { return $this->s[$k]; } + function offsetExists ($k) { return isset($this->s[$k]); } + function offsetUnset ($k) { unset($this->s[$k]); } +} + +$a = new StorageRef([1, 2]); +list(&$one, $two) = $a; +var_dump($a); + +$a = new StorageRef([1, 2]); +list(,,list($var)) = $a; +var_dump($a); + +$a = new StorageRef([1, 2]); +list(,,list(&$var)) = $a; +var_dump($a); + +$a = new StorageRef(['one' => 1, 'two' => 2]); +['one' => &$one, 'two' => $two] = $a; +var_dump($a); + +?> +--EXPECTF-- +object(StorageRef)#1 (1) { + ["s":"StorageRef":private]=> + array(2) { + [0]=> + &int(1) + [1]=> + int(2) + } +} +object(StorageRef)#2 (1) { + ["s":"StorageRef":private]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + NULL + } +} +object(StorageRef)#1 (1) { + ["s":"StorageRef":private]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + array(1) { + [0]=> + &NULL + } + } +} +object(StorageRef)#2 (1) { + ["s":"StorageRef":private]=> + array(2) { + ["one"]=> + &int(1) + ["two"]=> + int(2) + } +} diff --git a/Zend/tests/list/list_reference_008.phpt b/Zend/tests/list/list_reference_008.phpt new file mode 100644 index 0000000000..9c754a698d --- /dev/null +++ b/Zend/tests/list/list_reference_008.phpt @@ -0,0 +1,68 @@ +--TEST-- +"Reference Unpacking - Oddities" list() +--FILE-- +<?php +$a = 1; +$b =& $a; +$arr = [&$a, &$b]; +list(&$a, &$b) = $arr; +var_dump($a, $b, $arr); +$b++; +var_dump($a, $b, $arr); +unset($a, $b, $arr); + +/* + * $a is first set as a reference to the 0'th elem, '1' + * $a is then set to the value of the 1'st elem, '2' + * $arr would look like, [2,2] + * Increment $a, and it should be [3, 2] + */ +$arr = [1, 2]; +list(&$a, $a) = $arr; +var_dump($a); +$a++; +var_dump($arr); +unset($a, $arr); + +/* + * We do not allow references to the same variable of rhs. + */ +$a = [1, 2]; +$ref =& $a; +list(&$a, &$b) = $a; +var_dump($a, $b); +$a++; $b++; +var_dump($ref); +?> +--EXPECTF-- +int(1) +int(1) +array(2) { + [0]=> + &int(1) + [1]=> + &int(1) +} +int(2) +int(2) +array(2) { + [0]=> + &int(2) + [1]=> + &int(2) +} +int(2) +array(2) { + [0]=> + &int(3) + [1]=> + int(2) +} +int(1) +int(2) +array(2) { + [0]=> + &int(2) + [1]=> + &int(3) +} diff --git a/Zend/tests/list/list_reference_009.phpt b/Zend/tests/list/list_reference_009.phpt new file mode 100644 index 0000000000..f0adc1f088 --- /dev/null +++ b/Zend/tests/list/list_reference_009.phpt @@ -0,0 +1,47 @@ +--TEST-- +"Reference Unpacking - VM Safety" list() +--FILE-- +<?php +$ary = [[0, 1]]; +[[ + 0 => &$a, + ($ary["foo"] = 1) => &$b +]] = $ary; + +var_dump($ary, $a, $b); +unset($ary, $a, $b); + +$ary = [[0, 1]]; +[ + 0 => &$a, + ($ary["foo"] = 1) => &$b +] = $ary[0]; +var_dump($ary, $a, $b); +?> +--EXPECTF-- +array(2) { + [0]=> + array(2) { + [0]=> + &int(0) + [1]=> + &int(1) + } + ["foo"]=> + int(1) +} +int(0) +int(1) +array(2) { + [0]=> + array(2) { + [0]=> + &int(0) + [1]=> + &int(1) + } + ["foo"]=> + int(1) +} +int(0) +int(1) diff --git a/Zend/tests/list/list_reference_010.phpt b/Zend/tests/list/list_reference_010.phpt new file mode 100644 index 0000000000..8ceb344a33 --- /dev/null +++ b/Zend/tests/list/list_reference_010.phpt @@ -0,0 +1,8 @@ +--TEST-- +"Reference Unpacking - Compile Error (scalar)" list() +--FILE-- +<?php +list(&$foo) = [42]; +?> +--EXPECTF-- +Fatal error: Cannot assign reference to non referencable value in %s on line %d diff --git a/Zend/tests/list/list_reference_011.phpt b/Zend/tests/list/list_reference_011.phpt new file mode 100644 index 0000000000..405f34f227 --- /dev/null +++ b/Zend/tests/list/list_reference_011.phpt @@ -0,0 +1,9 @@ +--TEST-- +"Reference Unpacking - Compile Error (const)" list() +--FILE-- +<?php +const FOO = 10; +[&$f] = FOO; +?> +--EXPECTF-- +Fatal error: Cannot assign reference to non referencable value in %s on line %d diff --git a/Zend/tests/list_009.phpt b/Zend/tests/list_009.phpt deleted file mode 100644 index c28ca8000a..0000000000 --- a/Zend/tests/list_009.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -list with by-reference assignment should fail ---FILE-- -<?php - -$a = [1]; -[&$foo] = $a; -$foo = 2; - -var_dump($a); - -?> ---EXPECTF-- -Fatal error: [] and list() assignments cannot be by reference in %s on line %d diff --git a/Zend/tests/traits/bug63911.phpt b/Zend/tests/traits/bug63911.phpt new file mode 100644 index 0000000000..72892cdd34 --- /dev/null +++ b/Zend/tests/traits/bug63911.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #63911 (Ignore conflicting trait methods originationg from identical sub traits) +--FILE-- +<?php +trait A +{ + public function a(){ + echo 'Done'; + } +} +trait B +{ + use A; +} +trait C +{ + use A; +} +class D +{ + use B, C; +} + +(new D)->a(); +--EXPECT-- +Done diff --git a/Zend/tests/traits/bug74922.phpt b/Zend/tests/traits/bug74922.phpt new file mode 100644 index 0000000000..16272b8f68 --- /dev/null +++ b/Zend/tests/traits/bug74922.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #74922 (Composed class has fatal error with duplicate, equal const properties) +--FILE-- +<?php + +const VALUE = true; + +trait Foo {public $var = VALUE;} +trait Bar {public $var = VALUE;} +class Baz {use Foo, Bar;} + +echo "DONE"; + +?> +--EXPECT-- +DONE diff --git a/Zend/tests/traits/bug74922a.phpt b/Zend/tests/traits/bug74922a.phpt new file mode 100644 index 0000000000..40617bcdc8 --- /dev/null +++ b/Zend/tests/traits/bug74922a.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #74922 (Composed class has fatal error with duplicate, equal const properties) +--FILE-- +<?php + +const VALUE = true; + +trait Foo {public $var = VALUE;} +trait Bar {public $var = true;} +class Baz {use Foo, Bar;} + +echo "DONE"; + +?> +--EXPECT-- +DONE diff --git a/Zend/tests/traits/bug74922b.inc b/Zend/tests/traits/bug74922b.inc new file mode 100644 index 0000000000..b64ee21985 --- /dev/null +++ b/Zend/tests/traits/bug74922b.inc @@ -0,0 +1,9 @@ +<?php + +namespace Bug74922; + +const FOO = 'foo'; + +trait T1 { + public $var = FOO; +} diff --git a/Zend/tests/traits/bug74922b.phpt b/Zend/tests/traits/bug74922b.phpt new file mode 100644 index 0000000000..9a0f23546a --- /dev/null +++ b/Zend/tests/traits/bug74922b.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #74922 (Composed class has fatal error with duplicate, equal const properties) +--FILE-- +<?php + +require('bug74922b.inc'); + +trait T2 {public $var = Bug74922\FOO;} +class Baz {use Bug74922\T1, T2;} + +echo "DONE"; + +?> +--EXPECT-- +DONE diff --git a/Zend/tests/traits/bug74922c.phpt b/Zend/tests/traits/bug74922c.phpt new file mode 100644 index 0000000000..367bbf4eab --- /dev/null +++ b/Zend/tests/traits/bug74922c.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #74922 (Composed class has fatal error with duplicate, equal const properties) +--FILE-- +<?php + +trait T { + public $x = self::X; +} +trait T2 { + public $x = self::X; +} +class C { + use T, T2; + const X = 42; +} +var_dump((new C)->x); + +?> +--EXPECT-- +int(42) |