@@ -3185,9 +3185,9 @@ ZEND_METHOD(ReflectionIntersectionType, getTypes)
3185
3185
/* }}} */
3186
3186
3187
3187
/* {{{ Constructor. Throws an Exception in case the given method does not exist */
3188
- ZEND_METHOD ( ReflectionMethod , __construct )
3188
+ static void instantiate_reflection_method ( INTERNAL_FUNCTION_PARAMETERS , bool is_constructor )
3189
3189
{
3190
- zend_object * arg1_obj ;
3190
+ zend_object * arg1_obj = NULL ;
3191
3191
zend_string * arg1_str ;
3192
3192
zend_string * arg2_str = NULL ;
3193
3193
@@ -3202,11 +3202,17 @@ ZEND_METHOD(ReflectionMethod, __construct)
3202
3202
reflection_object * intern ;
3203
3203
zend_function * mptr ;
3204
3204
3205
- ZEND_PARSE_PARAMETERS_START (1 , 2 )
3206
- Z_PARAM_OBJ_OR_STR (arg1_obj , arg1_str )
3207
- Z_PARAM_OPTIONAL
3208
- Z_PARAM_STR_OR_NULL (arg2_str )
3209
- ZEND_PARSE_PARAMETERS_END ();
3205
+ if (is_constructor ) {
3206
+ ZEND_PARSE_PARAMETERS_START (1 , 2 )
3207
+ Z_PARAM_OBJ_OR_STR (arg1_obj , arg1_str )
3208
+ Z_PARAM_OPTIONAL
3209
+ Z_PARAM_STR_OR_NULL (arg2_str )
3210
+ ZEND_PARSE_PARAMETERS_END ();
3211
+ } else {
3212
+ ZEND_PARSE_PARAMETERS_START (1 , 1 )
3213
+ Z_PARAM_STR (arg1_str )
3214
+ ZEND_PARSE_PARAMETERS_END ();
3215
+ }
3210
3216
3211
3217
if (arg1_obj ) {
3212
3218
if (!arg2_str ) {
@@ -3250,7 +3256,12 @@ ZEND_METHOD(ReflectionMethod, __construct)
3250
3256
zend_string_release (class_name );
3251
3257
}
3252
3258
3253
- object = ZEND_THIS ;
3259
+ if (is_constructor ) {
3260
+ object = ZEND_THIS ;
3261
+ } else {
3262
+ object_init_ex (return_value , execute_data -> This .value .ce ? execute_data -> This .value .ce : reflection_method_ptr );
3263
+ object = return_value ;
3264
+ }
3254
3265
intern = Z_REFLECTION_P (object );
3255
3266
3256
3267
lcname = zend_str_tolower_dup (method_name , method_name_len );
@@ -3276,8 +3287,17 @@ ZEND_METHOD(ReflectionMethod, __construct)
3276
3287
intern -> ref_type = REF_TYPE_FUNCTION ;
3277
3288
intern -> ce = ce ;
3278
3289
}
3290
+
3291
+ /* {{{ Constructor. Throws an Exception in case the given method does not exist */
3292
+ ZEND_METHOD (ReflectionMethod , __construct ) {
3293
+ instantiate_reflection_method (INTERNAL_FUNCTION_PARAM_PASSTHRU , true);
3294
+ }
3279
3295
/* }}} */
3280
3296
3297
+ ZEND_METHOD (ReflectionMethod , createFromMethodName ) {
3298
+ instantiate_reflection_method (INTERNAL_FUNCTION_PARAM_PASSTHRU , false);
3299
+ }
3300
+
3281
3301
/* {{{ Returns a string representation */
3282
3302
ZEND_METHOD (ReflectionMethod , __toString )
3283
3303
{
0 commit comments