]> granicus.if.org Git - php/commitdiff
Forgot to git add rope leak test
authorBob Weinand <bobwei9@hotmail.com>
Sun, 28 Jun 2015 13:44:53 +0000 (15:44 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Sun, 28 Jun 2015 13:44:53 +0000 (15:44 +0200)
Zend/tests/rope_with_exception.phpt [new file with mode: 0644]

diff --git a/Zend/tests/rope_with_exception.phpt b/Zend/tests/rope_with_exception.phpt
new file mode 100644 (file)
index 0000000..e73ea64
--- /dev/null
@@ -0,0 +1,52 @@
+--TEST--
+Exceptions thrown into a rope must not leak
+--FILE--
+<?php
+
+class Obj {
+       function __get($x) {
+               throw new Exception();
+       }
+}
+
+try {
+       $x = new Obj;
+       $y = 0;
+       $r = "$y|$x->x|";
+       echo "should never be reached";
+} catch (Exception $e) {
+       echo "$e\n";
+}
+
+try {
+       $x = new Obj;
+       $y = 0;
+       $r = "$y$x->x|";
+       echo "should never be reached";
+} catch (Exception $e) {
+       echo "$e\n";
+}
+
+try {
+       $x = new Obj;
+       $y = 0;
+       $r = "$y|$y$x->x";
+       echo "should never be reached";
+} catch (Exception $e) {
+       echo "$e\n";
+}
+
+?>
+--EXPECTF--
+Exception in %s:%d
+Stack trace:
+#0 %s(%d): Obj->__get('x')
+#1 {main}
+Exception in %s:%d
+Stack trace:
+#0 %s(%d): Obj->__get('x')
+#1 {main}
+Exception in %s:%d
+Stack trace:
+#0 %s(%d): Obj->__get('x')
+#1 {main}