summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-04-08 20:37:06 +0000
committerMarcus Boerger <helly@php.net>2004-04-08 20:37:06 +0000
commit8ccfca0c41af8f20aa06305c1a3832095a866d3e (patch)
tree6db5a038548c50f4db8e726f4b1f66cba32ac25b
parent3ec166aba4bd2fe2490add97259c51ba24dbdf34 (diff)
downloadphp-git-8ccfca0c41af8f20aa06305c1a3832095a866d3e.tar.gz
Bugfix #27519 Reflection_Function constructor crashes with non-existant
function's name
-rw-r--r--Zend/zend_reflection_api.c4
-rw-r--r--ext/reflection/php_reflection.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c
index ea15bb381c..8f9c74f353 100644
--- a/Zend/zend_reflection_api.c
+++ b/Zend/zend_reflection_api.c
@@ -183,7 +183,7 @@ static void reflection_free_objects_storage(zend_object *object TSRMLS_DC)
{
reflection_object *intern = (reflection_object *) object;
- if (intern->free_ptr) {
+ if (intern->free_ptr && intern->ptr) {
efree(intern->ptr);
}
if (intern->obj) {
@@ -766,7 +766,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS
reflection_instanciate(reflection_function_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = function;
- intern->free_ptr = 0;
+ intern->free_ptr = function != NULL;
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
}
/* }}} */
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index ea15bb381c..8f9c74f353 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -183,7 +183,7 @@ static void reflection_free_objects_storage(zend_object *object TSRMLS_DC)
{
reflection_object *intern = (reflection_object *) object;
- if (intern->free_ptr) {
+ if (intern->free_ptr && intern->ptr) {
efree(intern->ptr);
}
if (intern->obj) {
@@ -766,7 +766,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS
reflection_instanciate(reflection_function_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = function;
- intern->free_ptr = 0;
+ intern->free_ptr = function != NULL;
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
}
/* }}} */