From 3f35f2252d13d8fef1555a72ee54a9bdeca097d0 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 14 Nov 2004 18:07:15 +0000 Subject: [PATCH] MFH #30783 Apache crash when using ReflectionFunction::getStaticVariables() MFH proto fixes --- Zend/zend_reflection_api.c | 16 ++++++++-------- ext/reflection/php_reflection.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index c102e2184e..3b2d282963 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -1156,7 +1156,7 @@ ZEND_METHOD(reflection, getModifierNames) } /* }}} */ -/* {{{ proto public static mixed ReflectionFunction::export(string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionFunction::export(string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_function, export) { @@ -1331,7 +1331,7 @@ ZEND_METHOD(reflection_function, getStaticVariables) /* Return an empty array in case no static variables exist */ array_init(return_value); - if (fptr->op_array.static_variables != NULL) { + if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) { zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); } } @@ -1459,7 +1459,7 @@ ZEND_METHOD(reflection_function, getParameters) } /* }}} */ -/* {{{ proto public static mixed ReflectionParameter::export(mixed function, mixed parameter, [, bool return]) throws ReflectionException +/* {{{ 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) { @@ -1750,7 +1750,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) } /* }}} */ -/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_method, export) { @@ -2050,7 +2050,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass) } /* }}} */ -/* {{{ proto public static mixed ReflectionClass::export(mixed argument, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionClass::export(mixed argument [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_class, export) { @@ -2831,7 +2831,7 @@ ZEND_METHOD(reflection_class, getExtensionName) } /* }}} */ -/* {{{ proto public static mixed ReflectionObject::export(mixed argument, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionObject::export(mixed argument [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_object, export) { @@ -2847,7 +2847,7 @@ ZEND_METHOD(reflection_object, __construct) } /* }}} */ -/* {{{ proto public static mixed ReflectionProperty::export(mixed class, string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionProperty::export(mixed class, string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_property, export) { @@ -3141,7 +3141,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass) zend_reflection_class_factory(ref->ce, return_value TSRMLS_CC); } -/* {{{ proto public static mixed ReflectionExtension::export(string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionExtension::export(string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_extension, export) { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index c102e2184e..3b2d282963 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1156,7 +1156,7 @@ ZEND_METHOD(reflection, getModifierNames) } /* }}} */ -/* {{{ proto public static mixed ReflectionFunction::export(string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionFunction::export(string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_function, export) { @@ -1331,7 +1331,7 @@ ZEND_METHOD(reflection_function, getStaticVariables) /* Return an empty array in case no static variables exist */ array_init(return_value); - if (fptr->op_array.static_variables != NULL) { + if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) { zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); } } @@ -1459,7 +1459,7 @@ ZEND_METHOD(reflection_function, getParameters) } /* }}} */ -/* {{{ proto public static mixed ReflectionParameter::export(mixed function, mixed parameter, [, bool return]) throws ReflectionException +/* {{{ 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) { @@ -1750,7 +1750,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue) } /* }}} */ -/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionMethod::export(mixed class, string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_method, export) { @@ -2050,7 +2050,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass) } /* }}} */ -/* {{{ proto public static mixed ReflectionClass::export(mixed argument, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionClass::export(mixed argument [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_class, export) { @@ -2831,7 +2831,7 @@ ZEND_METHOD(reflection_class, getExtensionName) } /* }}} */ -/* {{{ proto public static mixed ReflectionObject::export(mixed argument, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionObject::export(mixed argument [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_object, export) { @@ -2847,7 +2847,7 @@ ZEND_METHOD(reflection_object, __construct) } /* }}} */ -/* {{{ proto public static mixed ReflectionProperty::export(mixed class, string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionProperty::export(mixed class, string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_property, export) { @@ -3141,7 +3141,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass) zend_reflection_class_factory(ref->ce, return_value TSRMLS_CC); } -/* {{{ proto public static mixed ReflectionExtension::export(string name, [, bool return]) throws ReflectionException +/* {{{ proto public static mixed ReflectionExtension::export(string name [, bool return]) throws ReflectionException Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ ZEND_METHOD(reflection_extension, export) { -- 2.50.1