summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-01-29 15:16:51 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-01-30 09:19:02 +0100
commit4eb5db2c68ecab4fd50a5e1950fdd6eb3703b899 (patch)
treeea64d5a1676a75d1efe36c85173b9e6af3f53af1 /Zend
parent23a5be3696f4d92e1b18fd59f3ac63c6a15ea12a (diff)
downloadphp-git-4eb5db2c68ecab4fd50a5e1950fdd6eb3703b899.tar.gz
Forbid unbinding $this from methods
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/bug70681.phpt2
-rw-r--r--Zend/tests/closure_061.phpt8
-rw-r--r--Zend/zend_closures.c8
3 files changed, 6 insertions, 12 deletions
diff --git a/Zend/tests/bug70681.phpt b/Zend/tests/bug70681.phpt
index 9dd09b07b8..d0cc9523a9 100644
--- a/Zend/tests/bug70681.phpt
+++ b/Zend/tests/bug70681.phpt
@@ -12,5 +12,5 @@ var_dump($c("foo"));
?>
--EXPECTF--
-Warning: Cannot unbind $this of internal method in %s on line %d
+Warning: Cannot unbind $this of method in %s on line %d
int(3)
diff --git a/Zend/tests/closure_061.phpt b/Zend/tests/closure_061.phpt
index f01e393570..2c574c49c0 100644
--- a/Zend/tests/closure_061.phpt
+++ b/Zend/tests/closure_061.phpt
@@ -175,9 +175,7 @@ Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure
-------------------
bindTo(null, Cls::class):
-Unbinding $this of a method is deprecated
-
-Success!
+Cannot unbind $this of method
bindTo(new Cls, Cls::class):
Success!
@@ -210,10 +208,10 @@ bindTo(new ClsUnrelated, SplDoublyLinkedList::class):
Cannot bind method SplDoublyLinkedList::count() to object of class ClsUnrelated
bindTo(null, null):
-Cannot unbind $this of internal method
+Cannot unbind $this of method
bindTo(null, SplDoublyLinkedList::class):
-Cannot unbind $this of internal method
+Cannot unbind $this of method
bindTo(new SplDoublyLinkedList, null):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index c3dbf145e9..ac95108cae 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -84,12 +84,8 @@ static zend_bool zend_valid_closure_binding(
}
} else if (is_fake_closure && func->common.scope
&& !(func->common.fn_flags & ZEND_ACC_STATIC)) {
- if (func->type == ZEND_INTERNAL_FUNCTION) {
- zend_error(E_WARNING, "Cannot unbind $this of internal method");
- return 0;
- } else {
- zend_error(E_DEPRECATED, "Unbinding $this of a method is deprecated");
- }
+ zend_error(E_WARNING, "Cannot unbind $this of method");
+ return 0;
}
if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) {