As this is new functionality, I'm going directly for a TypeError,
rather than a deprecation warning.
--- /dev/null
+--TEST--
+Testing Closure::fromCallable() functionality: Getting non-static method statically
+--FILE--
+<?php
+
+class A {
+ public function method() {
+ }
+}
+
+try {
+ $fn = Closure::fromCallable(['A', 'method']);
+ $fn();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Failed to create closure from callable: non-static method A::method() should not be called statically
success = zend_create_closure_from_callable(return_value, callable, &error);
EG(current_execute_data) = execute_data;
- if (success == FAILURE) {
+ if (success == FAILURE || error) {
if (error) {
zend_throw_exception_ex(zend_ce_type_error, 0, "Failed to create closure from callable: %s", error);
efree(error);