com php-src: Fixed bug, removed implements Reflector sue to missing export method: ext/reflection/php_reflection.c ext/reflection/te
sts/ReflectionExtension_getClasses_basic.phpt
| From: | Matteo Beccati | Date: | Sat, 14 Feb 2015 20:02:57 +0000 |
| Subject: | com php-src: Fixed bug, removed implements Reflector sue to missing export method: ext/reflection/php_reflection.c ext/reflection/te sts/ReflectionExtension_getClasses_basic.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84888@lists.php.net to get a copy of this message | ||
Commit: 64d8bd9de682f733502aca1f598a171b33072033
Author: Matteo Beccati <mbeccati@php.net> Sat, 14 Feb 2015 21:02:57 +0100
Parents: 2113cb96cb6c6a29aa1c58d9e593c3e619673e20
Branches: scalar_hints_with_reflection
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=64d8bd9de682f733502aca1f598a171b33072033
Log:
Fixed bug, removed implements Reflector sue to missing export method
Changed paths:
M ext/reflection/php_reflection.c
M ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
Diff:
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 2c0a387..ced9d5d 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1283,22 +1283,22 @@ static void reflection_parameter_factory(zend_function *fptr, zval
*closure_obje
/* }}} */
/* {{{ reflection_typeannotation_factory */
-static void reflection_typeannotation_factory(zend_function *fptr, zval *closure_object, struct
_zend_arg_info *arg_info, zval *object TSRMLS_DC)
+static void reflection_typeannotation_factory(zend_function *fptr, zval *closure_object, struct
_zend_arg_info *arg_info, zval *object)
{
reflection_object *intern;
typeannotation_reference *reference;
- if (closure_object) {
- Z_ADDREF_P(closure_object);
- }
- reflection_instantiate(reflection_typeannotation_ptr, object TSRMLS_CC);
- intern = (reflection_object*) zend_object_store_get_object(object TSRMLS_CC);
+ reflection_instantiate(reflection_typeannotation_ptr, object);
+ intern = Z_REFLECTION_P(object);
reference = (typeannotation_reference*) emalloc(sizeof(typeannotation_reference));
reference->arg_info = arg_info;
intern->ptr = reference;
intern->ref_type = REF_TYPE_ANNOTATION;
intern->ce = fptr->common.scope;
- intern->obj = closure_object;
+ if (closure_object) {
+ Z_ADDREF_P(closure_object);
+ ZVAL_COPY_VALUE(&intern->obj, closure_object);
+ }
}
/* }}} */
@@ -2548,7 +2548,7 @@ ZEND_METHOD(reflection_parameter, getTypeAnnotation)
if (!param->arg_info->type_hint) {
RETURN_NULL();
}
- reflection_typeannotation_factory(param->fptr, intern->obj, param->arg_info, return_value
TSRMLS_CC);
+ reflection_typeannotation_factory(param->fptr, Z_ISUNDEF(intern->obj)? NULL :
&intern->obj, param->arg_info, return_value);
}
/* }}} */
@@ -2850,12 +2850,11 @@ ZEND_METHOD(reflection_typeannotation, __toString)
GET_REFLECTION_OBJECT_PTR(param);
switch (param->arg_info->type_hint) {
- case IS_ARRAY: RETURN_STRINGL("array", sizeof("array") - 1, 1);
- case IS_CALLABLE: RETURN_STRINGL("callable", sizeof("callable") - 1, 1);
- case IS_OBJECT: RETURN_STRINGL(param->arg_info->class_name,
- param->arg_info->class_name_len, 1);
+ case IS_ARRAY: RETURN_STRINGL("array", sizeof("array") - 1);
+ case IS_CALLABLE: RETURN_STRINGL("callable", sizeof("callable") - 1);
+ case IS_OBJECT: RETURN_STR(zend_string_copy(param->arg_info->class_name));
default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unknown type annotation: %d",
(int)param->arg_info->type_hint);
+ php_error_docref(NULL, E_ERROR, "Unknown type annotation: %d",
(int)param->arg_info->type_hint);
RETURN_EMPTY_STRING();
}
}
@@ -6347,8 +6346,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionTypeAnnotation",
reflection_typeannotation_functions);
_reflection_entry.create_object = reflection_objects_new;
- reflection_typeannotation_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
- reflection_register_implement(reflection_typeannotation_ptr, reflector_ptr TSRMLS_CC);
+ reflection_typeannotation_ptr = zend_register_internal_class(&_reflection_entry);
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions);
_reflection_entry.create_object = reflection_objects_new;
diff --git a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
index d823f00..3eb7204 100644
--- a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
@@ -40,13 +40,13 @@ array(13) {
["name"]=>
string(19) "ReflectionParameter"
}
- ["ReflectionMethod"]=>
+ ["ReflectionTypeAnnotation"]=>
object(ReflectionClass)#8 (1) {
["name"]=>
string(24) "ReflectionTypeAnnotation"
}
["ReflectionMethod"]=>
- &object(ReflectionClass)#9 (1) {
+ object(ReflectionClass)#9 (1) {
["name"]=>
string(16) "ReflectionMethod"
}