com php-src: Added test (failed with valgrind): Zend/tests/type _declarations/typed_properties_057.phpt
| From: | Bob Weinand | Date: | Wed, 25 May 2016 17:10:10 +0000 |
| Subject: | com php-src: Added test (failed with valgrind): Zend/tests/type _declarations/typed_properties_057.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95509@lists.php.net to get a copy of this message | ||
Commit: 892994d15e4cb3d47dc215f3c64f5cb139640f12
Author: Dmitry Stogov <dmitry@zend.com> Wed, 25 May 2016 20:10:10 +0300
Parents: d7f313e5c320758264bb4599ec6cfb347e07f797
Branches: typed_ref_properties
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=892994d15e4cb3d47dc215f3c64f5cb139640f12
Log:
Added test (failed with valgrind)
Changed paths:
A Zend/tests/type_declarations/typed_properties_057.phpt
Diff:
diff --git a/Zend/tests/type_declarations/typed_properties_057.phpt
b/Zend/tests/type_declarations/typed_properties_057.phpt
new file mode 100644
index 0000000..4b98dd1
--- /dev/null
+++ b/Zend/tests/type_declarations/typed_properties_057.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Type change in pre-increment (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 {
+ $x = ++$o->foo;
+} catch (Throwable $e) {
+ echo $e->getMessage() . "\n";
+}
+var_dump($o->foo);
+unset($o);
+?>
+--EXPECT--
+Typed property A::$foo must be string, integer used
+string(3) "100"