}
/* }}} */
+static void _fix_closure_prototype(zend_function *fptr) /* {{{ */
+{
+ /* Actually we are setting proxy function's prototype to null
+ * as for it, the prototype is an object not a function
+ * which could cause serias problems, see #74949 */
+ fptr->common.prototype = NULL;
+}
+/* }}} */
+
static void _free_function(zend_function *fptr) /* {{{ */
{
if (fptr
&& memcmp(ZSTR_VAL(mptr->common.function_name), ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
{
+ _fix_closure_prototype(closure);
mptr = closure;
} else {
closure = NULL;
}
/* }}} */
-
/* {{{ proto public static mixed ReflectionParameter::export(mixed function, mixed parameter [, bool return]) throws ReflectionException
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
ZEND_METHOD(reflection_parameter, export)
{
/* nothing to do. don't set is_closure since is the invoke handler,
not the closure itself */
+ _fix_closure_prototype(fptr);
} else if ((fptr = zend_hash_str_find_ptr(&ce->function_table, lcname, lcname_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
&& (mptr = zend_get_closure_invoke_method(Z_OBJ_P(orig_obj))) != NULL)
{
/* do nothing, mptr already set */
+ _fix_closure_prototype(mptr);
} else if ((mptr = zend_hash_str_find_ptr(&ce->function_table, lcname, name_len)) == NULL) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
{
/* don't assign closure_object since we only reflect the invoke handler
method and not the closure definition itself */
+ _fix_closure_prototype(mptr);
reflection_method_factory(ce, mptr, NULL, return_value);
efree(lc_name);
} else if (ce == zend_ce_closure && Z_ISUNDEF(intern->obj) && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
&& object_init_ex(&obj_tmp, ce) == SUCCESS && (mptr = zend_get_closure_invoke_method(Z_OBJ(obj_tmp))) != NULL) {
/* don't assign closure_object since we only reflect the invoke handler
method and not the closure definition itself */
+ _fix_closure_prototype(mptr);
reflection_method_factory(ce, mptr, NULL, return_value);
zval_dtor(&obj_tmp);
efree(lc_name);
&& memcmp(ZSTR_VAL(mptr->common.function_name), ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
&& (closure = zend_get_closure_invoke_method(Z_OBJ_P(obj))) != NULL)
{
+ _fix_closure_prototype(closure);
mptr = closure;
}
/* don't assign closure_object since we only reflect the invoke handler
if (Z_TYPE(intern->obj) != IS_UNDEF && instanceof_function(ce, zend_ce_closure)) {
zend_function *closure = zend_get_closure_invoke_method(Z_OBJ(intern->obj));
if (closure) {
+ _fix_closure_prototype(closure);
_addmethod(closure, ce, return_value, filter, &intern->obj);
_free_function(closure);
}