From 10642aa9e4f1eb694a8f7b514cc234cb24545744 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 1 Aug 2012 20:23:30 +0800 Subject: Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) --- ext/reflection/php_reflection.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e98652ba23..23c9044981 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2379,9 +2379,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) { RETURN_FALSE; } - if (param->offset < param->required) { - RETURN_FALSE; - } + precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) { RETURN_FALSE; -- cgit v1.2.1 From 170ee90bf962d288bdcf6cf0c8c4a2a30c5c1ba2 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 2 Aug 2012 22:28:04 +0800 Subject: Fixed bug that can not get default value of parameter if it's not `optional` --- ext/reflection/php_reflection.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 7e80deaac6..6656f58c65 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1477,11 +1477,6 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO return NULL; } - if (param->offset < param->required) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); - return NULL; - } - return param; } /* }}} */ @@ -1497,7 +1492,7 @@ static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) { - zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); + zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error: Failed to retrieve the default value"); return NULL; } -- cgit v1.2.1 From 7a56ac00a04d4fc72052bb679626e723da3eef44 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 22 Aug 2012 10:50:50 -0300 Subject: - Fixed bug #62892 (ReflectionClass::getTraitAliases crashes on importing trait methods as private) --- ext/reflection/php_reflection.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6656f58c65..7c9981924d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4464,8 +4464,10 @@ ZEND_METHOD(reflection_class, getTraitAliases) int method_name_len; zend_trait_method_reference *cur_ref = ce->trait_aliases[i]->trait_method; - method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name); - add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0); + if (ce->trait_aliases[i]->alias) { + method_name_len = spprintf(&method_name, 0, "%s::%s", cur_ref->class_name, cur_ref->method_name); + add_assoc_stringl_ex(return_value, ce->trait_aliases[i]->alias, ce->trait_aliases[i]->alias_len + 1, method_name, method_name_len, 0); + } i++; } } -- cgit v1.2.1