Don't forbid null binding on plain functions.
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
$c = $c->bindTo(null);
+$c = (new ReflectionFunction('strlen'))->getClosure();
+$c = $c->bindTo(null);
+var_dump($c("foo"));
+
?>
--EXPECTF--
Warning: Cannot unbind $this of internal method in %s on line %d
+int(3)
}
if (newthis == NULL && !(closure->func.common.fn_flags & ZEND_ACC_STATIC)
- && closure->func.type == ZEND_INTERNAL_FUNCTION) {
+ && closure->func.common.scope && closure->func.type == ZEND_INTERNAL_FUNCTION) {
zend_error(E_WARNING, "Cannot unbind $this of internal method");
return;
}