diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-02-19 00:00:50 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-02-19 13:19:37 +0100 |
commit | 4f892118106741b1765c4704d1feb89a4eade38a (patch) | |
tree | 39f709d49c4d28296f8320246ff7c27485413563 /ext/reflection/php_reflection.c | |
parent | 318fe06042a2196e4f79a0141ab71b26a6a3a277 (diff) | |
download | php-git-4f892118106741b1765c4704d1feb89a4eade38a.tar.gz |
Remove the deprecated reflection export methods
Closes GH-5188
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 194 |
1 files changed, 0 insertions, 194 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 8d2d53b028..101913c494 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1261,101 +1261,6 @@ static void reflection_class_constant_factory(zend_class_entry *ce, zend_string } /* }}} */ -static void reflection_export_impl(zval *return_value, zval *object, zend_bool return_output) { - zval fname, retval; - int result; - - /* Invoke the __toString() method */ - ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1); - result = call_user_function(NULL, object, &fname, &retval, 0, NULL); - zval_ptr_dtor_str(&fname); - - if (result == FAILURE) { - _DO_THROW("Invocation of method __toString() failed"); - RETURN_THROWS(); - } - - if (Z_TYPE(retval) == IS_UNDEF) { - php_error_docref(NULL, E_WARNING, "%s::__toString() did not return anything", ZSTR_VAL(Z_OBJCE_P(object)->name)); - RETURN_FALSE; - } - - if (return_output) { - ZVAL_COPY_VALUE(return_value, &retval); - } else { - /* No need for _r variant, return of __toString should always be a string */ - zend_print_zval(&retval, 0); - zend_printf("\n"); - zval_ptr_dtor(&retval); - } -} - -/* {{{ _reflection_export */ -static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_ptr, int ctor_argc) -{ - zval reflector; - zval *argument_ptr, *argument2_ptr; - zval retval, params[2]; - int result; - int return_output = 0; - zend_fcall_info fci; - zend_fcall_info_cache fcc; - - if (ctor_argc == 1) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &argument_ptr, &return_output) == FAILURE) { - RETURN_THROWS(); - } - ZVAL_COPY_VALUE(¶ms[0], argument_ptr); - ZVAL_NULL(¶ms[1]); - } else { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|b", &argument_ptr, &argument2_ptr, &return_output) == FAILURE) { - RETURN_THROWS(); - } - ZVAL_COPY_VALUE(¶ms[0], argument_ptr); - ZVAL_COPY_VALUE(¶ms[1], argument2_ptr); - } - - /* Create object */ - if (object_init_ex(&reflector, ce_ptr) == FAILURE) { - _DO_THROW("Could not create reflector"); - RETURN_THROWS(); - } - - /* Call __construct() */ - - fci.size = sizeof(fci); - ZVAL_UNDEF(&fci.function_name); - fci.object = Z_OBJ(reflector); - fci.retval = &retval; - fci.param_count = ctor_argc; - fci.params = params; - fci.no_separation = 1; - - fcc.function_handler = ce_ptr->constructor; - fcc.called_scope = Z_OBJCE(reflector); - fcc.object = Z_OBJ(reflector); - - result = zend_call_function(&fci, &fcc); - - zval_ptr_dtor(&retval); - - if (EG(exception)) { - zval_ptr_dtor(&reflector); - RETURN_THROWS(); - } - if (result == FAILURE) { - zval_ptr_dtor(&reflector); - _DO_THROW("Could not create reflector"); - RETURN_THROWS(); - } - - reflection_export_impl(return_value, &reflector, return_output); - - /* Destruct reflector which is no longer needed */ - zval_ptr_dtor(&reflector); -} -/* }}} */ - /* {{{ _reflection_param_get_default_param */ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTION_PARAMETERS) { @@ -1408,23 +1313,6 @@ ZEND_METHOD(reflection, __clone) } /* }}} */ -/* {{{ proto public static mixed Reflection::export(Reflector r [, bool return]) - Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ -ZEND_METHOD(reflection, export) -{ - zval *object; - zend_bool return_output = 0; - - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_OBJECT_OF_CLASS(object, reflector_ptr) - Z_PARAM_OPTIONAL - Z_PARAM_BOOL(return_output) - ZEND_PARSE_PARAMETERS_END(); - - reflection_export_impl(return_value, object, return_output); -} -/* }}} */ - /* {{{ proto public static array Reflection::getModifierNames(int modifiers) Returns an array of modifier names */ ZEND_METHOD(reflection, getModifierNames) @@ -1463,14 +1351,6 @@ ZEND_METHOD(reflection, getModifierNames) } /* }}} */ -/* {{{ proto public static mixed ReflectionFunction::export(string name [, bool return]) - Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */ -ZEND_METHOD(reflection_function, export) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_function_ptr, 1); -} -/* }}} */ - /* {{{ proto public void ReflectionFunction::__construct(string name) Constructor. Throws an Exception in case the given function does not exist */ ZEND_METHOD(reflection_function, __construct) @@ -2227,14 +2107,6 @@ ZEND_METHOD(reflection_generator, getExecutingGenerator) } /* }}} */ -/* {{{ 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) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_parameter_ptr, 2); -} -/* }}} */ - /* {{{ proto public void ReflectionParameter::__construct(mixed function, mixed parameter) Constructor. Throws an Exception in case the given method does not exist */ ZEND_METHOD(reflection_parameter, __construct) @@ -2986,14 +2858,6 @@ ZEND_METHOD(reflection_union_type, getTypes) } /* }}} */ -/* {{{ 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) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_method_ptr, 2); -} -/* }}} */ - /* {{{ proto public void ReflectionMethod::__construct(mixed class_or_method [, string name]) Constructor. Throws an Exception in case the given method does not exist */ ZEND_METHOD(reflection_method, __construct) @@ -3750,14 +3614,6 @@ ZEND_METHOD(reflection_class_constant, getDocComment) } /* }}} */ -/* {{{ 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) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_class_ptr, 1); -} -/* }}} */ - /* {{{ reflection_class_object_ctor */ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_object) { @@ -5254,14 +5110,6 @@ ZEND_METHOD(reflection_class, getShortName) } /* }}} */ -/* {{{ 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) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_object_ptr, 1); -} -/* }}} */ - /* {{{ proto public void ReflectionObject::__construct(mixed argument) throws ReflectionException Constructor. Takes an instance as an argument */ ZEND_METHOD(reflection_object, __construct) @@ -5270,22 +5118,6 @@ ZEND_METHOD(reflection_object, __construct) } /* }}} */ -/* {{{ 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) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_property_ptr, 2); -} -/* }}} */ - -/* {{{ proto public static mixed ReflectionClassConstant::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_class_constant, export) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_class_constant_ptr, 2); -} -/* }}} */ - /* {{{ proto public void ReflectionProperty::__construct(mixed class, string name) Constructor. Throws an Exception in case the given property does not exist */ ZEND_METHOD(reflection_property, __construct) @@ -5782,14 +5614,6 @@ ZEND_METHOD(reflection_property, getDefaultValue) } /* }}} */ -/* {{{ 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) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_extension_ptr, 1); -} -/* }}} */ - /* {{{ proto public void ReflectionExtension::__construct(string name) Constructor. Throws an Exception in case the given extension does not exist */ ZEND_METHOD(reflection_extension, __construct) @@ -6137,14 +5961,6 @@ ZEND_METHOD(reflection_extension, isTemporary) } /* }}} */ -/* {{{ proto public static mixed ReflectionZendExtension::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_zend_extension, export) -{ - _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, reflection_zend_extension_ptr, 1); -} -/* }}} */ - /* {{{ proto public void ReflectionZendExtension::__construct(string name) Constructor. Throws an Exception in case the given Zend extension does not exist */ ZEND_METHOD(reflection_zend_extension, __construct) @@ -6390,7 +6206,6 @@ static const zend_function_entry reflection_exception_functions[] = { static const zend_function_entry reflection_functions[] = { ZEND_ME(reflection, getModifierNames, arginfo_class_Reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - ZEND_DEP_ME(reflection, export, arginfo_class_Reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_FE_END }; @@ -6432,7 +6247,6 @@ static const zend_function_entry reflection_function_abstract_functions[] = { static const zend_function_entry reflection_function_functions[] = { ZEND_ME(reflection_function, __construct, arginfo_class_ReflectionFunction___construct, 0) ZEND_ME(reflection_function, __toString, arginfo_class_ReflectionFunction___toString, 0) - ZEND_DEP_ME(reflection_function, export, arginfo_class_ReflectionFunction_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_function, isDisabled, arginfo_class_ReflectionFunction_isDisabled, 0) ZEND_ME(reflection_function, invoke, arginfo_class_ReflectionFunction_invoke, 0) ZEND_ME(reflection_function, invokeArgs, arginfo_class_ReflectionFunction_invokeArgs, 0) @@ -6452,7 +6266,6 @@ static const zend_function_entry reflection_generator_functions[] = { }; static const zend_function_entry reflection_method_functions[] = { - ZEND_DEP_ME(reflection_method, export, arginfo_class_ReflectionMethod_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_method, __construct, arginfo_class_ReflectionMethod___construct, 0) ZEND_ME(reflection_method, __toString, arginfo_class_ReflectionMethod___toString, 0) ZEND_ME(reflection_method, isPublic, arginfo_class_ReflectionMethod_isPublic, 0) @@ -6475,7 +6288,6 @@ static const zend_function_entry reflection_method_functions[] = { static const zend_function_entry reflection_class_functions[] = { ZEND_ME(reflection, __clone, arginfo_class_ReflectionClass___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_class, export, arginfo_class_ReflectionClass_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_class, __construct, arginfo_class_ReflectionClass___construct, 0) ZEND_ME(reflection_class, __toString, arginfo_class_ReflectionClass___toString, 0) ZEND_ME(reflection_class, getName, arginfo_class_ReflectionClass_getName, 0) @@ -6532,14 +6344,12 @@ static const zend_function_entry reflection_class_functions[] = { }; static const zend_function_entry reflection_object_functions[] = { - ZEND_DEP_ME(reflection_object, export, arginfo_class_ReflectionObject_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_object, __construct, arginfo_class_ReflectionObject___construct, 0) PHP_FE_END }; static const zend_function_entry reflection_property_functions[] = { ZEND_ME(reflection, __clone, arginfo_class_ReflectionProperty___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_property, export, arginfo_class_ReflectionProperty_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_property, __construct, arginfo_class_ReflectionProperty___construct, 0) ZEND_ME(reflection_property, __toString, arginfo_class_ReflectionProperty___toString, 0) ZEND_ME(reflection_property, getName, arginfo_class_ReflectionProperty_getName, 0) @@ -6564,7 +6374,6 @@ static const zend_function_entry reflection_property_functions[] = { static const zend_function_entry reflection_class_constant_functions[] = { ZEND_ME(reflection, __clone, arginfo_class_ReflectionClassConstant___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_class_constant, export, arginfo_class_ReflectionClassConstant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_class_constant, __construct, arginfo_class_ReflectionClassConstant___construct, 0) ZEND_ME(reflection_class_constant, __toString, arginfo_class_ReflectionClassConstant___toString, 0) ZEND_ME(reflection_class_constant, getName, arginfo_class_ReflectionClassConstant_getName, 0) @@ -6580,7 +6389,6 @@ static const zend_function_entry reflection_class_constant_functions[] = { static const zend_function_entry reflection_parameter_functions[] = { ZEND_ME(reflection, __clone, arginfo_class_ReflectionParameter___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_parameter, export, arginfo_class_ReflectionParameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_parameter, __construct, arginfo_class_ReflectionParameter___construct, 0) ZEND_ME(reflection_parameter, __toString, arginfo_class_ReflectionParameter___toString, 0) ZEND_ME(reflection_parameter, getName, arginfo_class_ReflectionParameter_getName, 0) @@ -6624,7 +6432,6 @@ static const zend_function_entry reflection_union_type_functions[] = { static const zend_function_entry reflection_extension_functions[] = { ZEND_ME(reflection, __clone, arginfo_class_ReflectionExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_extension, export, arginfo_class_ReflectionExtension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_extension, __construct, arginfo_class_ReflectionExtension___construct, 0) ZEND_ME(reflection_extension, __toString, arginfo_class_ReflectionExtension___toString, 0) ZEND_ME(reflection_extension, getName, arginfo_class_ReflectionExtension_getName, 0) @@ -6643,7 +6450,6 @@ static const zend_function_entry reflection_extension_functions[] = { static const zend_function_entry reflection_zend_extension_functions[] = { ZEND_ME(reflection, __clone, arginfo_class_ReflectionZendExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - ZEND_DEP_ME(reflection_zend_extension, export, arginfo_class_ReflectionZendExtension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) ZEND_ME(reflection_zend_extension, __construct, arginfo_class_ReflectionZendExtension___construct, 0) ZEND_ME(reflection_zend_extension, __toString, arginfo_class_ReflectionZendExtension___toString, 0) ZEND_ME(reflection_zend_extension, getName, arginfo_class_ReflectionZendExtension_getName, 0) |