summaryrefslogtreecommitdiff
path: root/Zend/tests/bug70630.phpt
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-10-04 01:38:59 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-10-04 01:38:59 +0200
commit517b5536259ecf7697f353f4bfbafde857fc1f81 (patch)
treefbc76217a0b2489e4e3e251343654293d7e9cc19 /Zend/tests/bug70630.phpt
parent4cb6342426aad20d8f92042855499bd4ea4d834c (diff)
downloadphp-git-517b5536259ecf7697f353f4bfbafde857fc1f81.tar.gz
Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())
This additionally removes support for binding to an unknown (not in parent hierarchy) scope. Removing support for cross-scope is necessary for certain compile-time assumptions (like class constants) to prevent unexpected results
Diffstat (limited to 'Zend/tests/bug70630.phpt')
-rw-r--r--Zend/tests/bug70630.phpt24
1 files changed, 24 insertions, 0 deletions
diff --git a/Zend/tests/bug70630.phpt b/Zend/tests/bug70630.phpt
new file mode 100644
index 0000000000..3dabca66da
--- /dev/null
+++ b/Zend/tests/bug70630.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())
+--FILE--
+<?php
+
+class a {}
+function foo() {}
+
+foreach (["substr", "foo"] as $fn) {
+ $x = (new ReflectionFunction($fn))->getClosure();
+ $x->call(new a);
+ Closure::bind($x, new a, "a");
+}
+
+?>
+--EXPECTF--
+
+Warning: Cannot bind function substr to an object in %s on line %d
+
+Warning: Cannot bind function substr to an object in %s on line %d
+
+Warning: Cannot bind function foo to an object in %s on line %d
+
+Warning: Cannot bind function foo to an object in %s on line %d