4. Deprecated Functionality
========================================
+- Core:
+ . Unbinding $this of a non-static method through a combination of
+ ReflectionMethod::getClosure() and closure rebinding is deprecated. Doing
+ so is equivalent to calling a non-static method statically, which has been
+ deprecated since PHP 7.0.
+
========================================
5. Changed Functions
========================================
-------------------
bindTo(null, Cls::class):
+Unbinding $this of a method is deprecated
+
Success!
bindTo(new Cls, Cls::class):
ZSTR_VAL(Z_OBJCE_P(newthis)->name));
return 0;
}
- } else if (!(func->common.fn_flags & ZEND_ACC_STATIC) && func->common.scope
- && func->type == ZEND_INTERNAL_FUNCTION) {
- zend_error(E_WARNING, "Cannot unbind $this of internal method");
- return 0;
+ } 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");
+ }
}
if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) {