summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/closures/cloure_from_callbable.inc (renamed from Zend/tests/closures/closureFunction.inc)0
-rw-r--r--Zend/tests/closures/cloure_from_callbable_basic.phpt (renamed from Zend/tests/closures/closureFunction_basic.phpt)2
-rw-r--r--Zend/tests/closures/cloure_from_callbable_error.phpt (renamed from Zend/tests/closures/closureFunction_error.phpt)2
-rw-r--r--Zend/tests/closures/cloure_from_callbable_reflection.phpt48
-rw-r--r--Zend/zend_closures.c2
5 files changed, 51 insertions, 3 deletions
diff --git a/Zend/tests/closures/closureFunction.inc b/Zend/tests/closures/cloure_from_callbable.inc
index 5f0f220974..5f0f220974 100644
--- a/Zend/tests/closures/closureFunction.inc
+++ b/Zend/tests/closures/cloure_from_callbable.inc
diff --git a/Zend/tests/closures/closureFunction_basic.phpt b/Zend/tests/closures/cloure_from_callbable_basic.phpt
index 676c643463..c498a9644b 100644
--- a/Zend/tests/closures/closureFunction_basic.phpt
+++ b/Zend/tests/closures/cloure_from_callbable_basic.phpt
@@ -3,7 +3,7 @@ Testing closure() functionality
--FILE--
<?php
-include('closureFunction.inc');
+include('cloure_from_callbable.inc');
echo 'Access public static function';
$fn = Closure::fromCallable(['Foo', 'publicStaticFunction']);
diff --git a/Zend/tests/closures/closureFunction_error.phpt b/Zend/tests/closures/cloure_from_callbable_error.phpt
index 1200aad18e..79fbf14757 100644
--- a/Zend/tests/closures/closureFunction_error.phpt
+++ b/Zend/tests/closures/cloure_from_callbable_error.phpt
@@ -3,7 +3,7 @@ Testing closure() functionality
--FILE--
<?php
-include('closureFunction.inc');
+include('cloure_from_callbable.inc');
echo 'Cannot access privateInstance method statically'."\n";
try {
diff --git a/Zend/tests/closures/cloure_from_callbable_reflection.phpt b/Zend/tests/closures/cloure_from_callbable_reflection.phpt
new file mode 100644
index 0000000000..0d2dc4980b
--- /dev/null
+++ b/Zend/tests/closures/cloure_from_callbable_reflection.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Imagick::readImage test
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+class Bar {
+ public static function staticMethod(Bar $bar, int $int, $none) {}
+ public static function instanceMethod(Bar $bar, int $int, $none) {}
+}
+
+function foo(Bar $bar, int $int, $none) {
+
+}
+
+$fn = function (Bar $bar, int $x, $none) {};
+$bar = new Bar();
+
+$callables = [
+ 'foo',
+ $fn,
+ 'Bar::staticMethod',
+ [$bar, 'instanceMethod']
+];
+
+
+foreach ($callables as $callable) {
+ $closure = Closure::fromCallable($callable);
+ $refl = new ReflectionFunction($closure);
+ foreach ($refl->getParameters() as $param) {
+ if ($param->hasType()) {
+ $type = $param->getType();
+ echo $type->__toString() . "\n";
+ }
+ }
+}
+
+?>
+--EXPECTF--
+Bar
+int
+Bar
+int
+Bar
+int
+Bar
+int
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 4d2eddfcbd..dadf461d71 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -589,7 +589,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_call, 0, 0, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_fromcallable, 0, 0, 1)
- ZEND_ARG_INFO(0, newthis)
+ ZEND_ARG_INFO(0, callable)
ZEND_END_ARG_INFO()
static const zend_function_entry closure_functions[] = {