diff options
Diffstat (limited to 'Zend/tests/type_declarations/typed_properties_056.phpt')
-rw-r--r-- | Zend/tests/type_declarations/typed_properties_056.phpt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Zend/tests/type_declarations/typed_properties_056.phpt b/Zend/tests/type_declarations/typed_properties_056.phpt new file mode 100644 index 0000000000..54013f44f2 --- /dev/null +++ b/Zend/tests/type_declarations/typed_properties_056.phpt @@ -0,0 +1,23 @@ +--TEST-- +Type change in assign_op (use-after-free) +--FILE-- +<?php +declare(strict_types=1); + +class A { + public string $foo; +} + +$o = new A; +$o->foo = "1" . str_repeat("0", 2); +try { + $o->foo += 5; +} catch (Throwable $e) { + echo $e->getMessage() . "\n"; +} +var_dump($o->foo); +unset($o); +?> +--EXPECT-- +Typed property A::$foo must be string, int used +string(3) "100" |