summaryrefslogtreecommitdiff
path: root/Zend/tests/compound_assign_failure.phpt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-12-02 15:14:37 +0300
committerDmitry Stogov <dmitry@zend.com>2016-12-02 15:14:37 +0300
commitb3a4de65cd7f46dd7e3c0d4dabbf894d1fdcd85b (patch)
tree6e9d49a05187fb5644dedf3a006c4da783ef9562 /Zend/tests/compound_assign_failure.phpt
parent5a57b3d6e0c6cc86582f0f1e96fc6385eac51f58 (diff)
parent2b70d44b57a4ec3b449c70e6deb547415c2623e7 (diff)
downloadphp-git-b3a4de65cd7f46dd7e3c0d4dabbf894d1fdcd85b.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed behavior of failing compound assignments (they shouldn't change the source value when exception thrown during type converion).
Diffstat (limited to 'Zend/tests/compound_assign_failure.phpt')
-rw-r--r--Zend/tests/compound_assign_failure.phpt17
1 files changed, 17 insertions, 0 deletions
diff --git a/Zend/tests/compound_assign_failure.phpt b/Zend/tests/compound_assign_failure.phpt
index f1afc783a0..f8d863106a 100644
--- a/Zend/tests/compound_assign_failure.phpt
+++ b/Zend/tests/compound_assign_failure.phpt
@@ -1,5 +1,7 @@
--TEST--
Behavior of failing compound assignment
+--INI--
+opcache.optimization_level=0
--FILE--
<?php
@@ -17,8 +19,23 @@ try {
$a = 1;
$a <<= -1;
} catch (Error $e) { var_dump($a); }
+
+set_error_handler(function() { throw new Exception; });
+
+try {
+ $a = [];
+ $a .= "foo";
+} catch (Throwable $e) { var_dump($a); }
+
+try {
+ $a = "foo";
+ $a .= [];
+} catch (Throwable $e) { var_dump($a); }
?>
--EXPECT--
int(1)
int(1)
int(1)
+array(0) {
+}
+string(3) "foo"