summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
authorAnthony Ferrara <ircmaxell@gmail.com>2012-07-10 10:31:25 -0400
committerAnthony Ferrara <ircmaxell@gmail.com>2012-07-10 10:31:25 -0400
commit731c6fd274932a4d31a76a38a4006cad6ffc50d3 (patch)
tree60f3f3da7cc29954a7dd0f8c9203acccba8174b8 /ext/reflection
parent03536e889ad29ed3b6153aafa77b647bdcfe2592 (diff)
parentb210766084cbd00b0e479d2800e1920271a3faba (diff)
downloadphp-git-731c6fd274932a4d31a76a38a4006cad6ffc50d3.tar.gz
Merge remote branch 'upstream/master' into hash_pbkdf2
* upstream/master: (101 commits) Fixed Bug #62500 (Segfault in DateInterval class when extended) Fixed test bug #62312 (warnings changed one more time) fix valgrind warning fix valgrind warning fixed #62433 test for win update NEWS Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false) appease MSVC (doesnt like unary minus of unsigned ints) appease MSVC (doesnt like unary minus of unsigned ints) appease MSVC (doesnt like unary minus of unsigned ints) - Fixed bug #62507 (['REQUEST_TIME'] under mod_php5 returns miliseconds instead of seconds) Fixed Bug #62500 (Segfault in DateInterval class when extended) Added in NEWS and UPGRADING for feature 55218 Fix two issues with run-tests.php Fix potential integer overflow in nl2br Fix potential integer overflow in bin2hex This wil be PHP 5.3.16 Revert change 3f3ad30c50: There shouldn't be new features in 5.3, especially not if they aren't in 5.4, too. fix (signed) integer overflow (part of bug #52550 fix (signed) integer overflow (part of bug #52550 ...
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/php_reflection.c8
-rw-r--r--ext/reflection/tests/bug62384.phpt21
2 files changed, 29 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 9346587eb7..ee76afbc02 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2923,6 +2923,14 @@ ZEND_METHOD(reflection_method, invokeArgs)
fcc.calling_scope = obj_ce;
fcc.called_scope = intern->ce;
fcc.object_ptr = object;
+
+ /*
+ * Copy the zend_function when calling via handler (e.g. Closure::__invoke())
+ */
+ if (mptr->type == ZEND_INTERNAL_FUNCTION &&
+ (mptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) {
+ fcc.function_handler = _copy_function(mptr TSRMLS_CC);
+ }
result = zend_call_function(&fci, &fcc TSRMLS_CC);
diff --git a/ext/reflection/tests/bug62384.phpt b/ext/reflection/tests/bug62384.phpt
new file mode 100644
index 0000000000..90a871fa2a
--- /dev/null
+++ b/ext/reflection/tests/bug62384.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #62384 (Attempting to invoke a Closure more than once causes segfaul)
+--FILE--
+<?php
+
+$closure1 = function($val){ return $val; };
+$closure2 = function($val){ return $val; };
+
+$reflection_class = new ReflectionClass($closure1);
+$reflection_method = $reflection_class->getMethod('__invoke');
+
+$arguments1 = array('hello');
+$arguments2 = array('world');
+
+var_dump($reflection_method->invokeArgs($closure1, $arguments1));
+var_dump($reflection_method->invokeArgs($closure2, $arguments2));
+
+?>
+--EXPECT--
+string(5) "hello"
+string(5) "world"