<?php
$dict = new COM("Scripting.Dictionary");
+$reflection = new ReflectionObject($dict);
ob_start();
-ReflectionObject::export($dict);
+echo $reflection;
ob_get_clean();
echo 'done';
}
/* }}} */
-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)
{
}
/* }}} */
-/* {{{ 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)
}
/* }}} */
-/* {{{ 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)
}
/* }}} */
-/* {{{ 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)
}
/* }}} */
-/* {{{ 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)
}
/* }}} */
-/* {{{ 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)
{
}
/* }}} */
-/* {{{ 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)
}
/* }}} */
-/* {{{ 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)
}
/* }}} */
-/* {{{ 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)
}
/* }}} */
-/* {{{ 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)
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
};
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)
};
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)
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)
};
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)
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)
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)
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)
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)
{
/** @return string[] */
public static function getModifierNames(int $modifiers) {}
-
- public static function export(Reflector $reflector, bool $return = false) {}
}
interface Reflector
/** @return string */
public function __toString() {}
- public static function export($name, bool $return = false) {}
-
/** @return bool */
public function isDisabled() {}
/** @return string */
public function __toString() {}
- public static function export($class, $name, bool $return = false) {}
-
/** @return bool */
public function isPublic() {}
{
final private function __clone() {}
- public static function export($argument, bool $return = false) {}
-
/** @param object|string $argument */
public function __construct($argument) {}
class ReflectionObject extends ReflectionClass
{
public function __construct(object $argument) {}
-
- public static function export($argument, bool $return = false) {}
}
class ReflectionProperty implements Reflector
{
final private function __clone() {}
- public static function export($class, $name, bool $return = false) {}
-
/** @param string|object $class */
public function __construct($class, string $name) {}
{
final private function __clone() {}
- public static function export($class, $name, bool $return = false) {}
-
/** @return string|object */
public function __construct($class, string $name) {}
{
final private function __clone() {}
- public static function export($function, $parameter, bool $return = false) {}
-
/**
* @param string|array|object
* @param int|string
{
final private function __clone() {}
- public static function export($name, bool $return = false) {}
-
public function __construct(string $name) {}
/** @return string */
{
final private function __clone() {}
- public static function export($name, bool $return = false) {}
-
public function __construct(string $name) {}
/** @return string */
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_export, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, reflector, Reflector, 0)
- ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflector___toString, 0, 0, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_ReflectionFunction___toString arginfo_class_Reflector___toString
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_export, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
-ZEND_END_ARG_INFO()
-
#define arginfo_class_ReflectionFunction_isDisabled arginfo_class_Reflector___toString
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invoke, 0, 0, 0)
#define arginfo_class_ReflectionMethod___toString arginfo_class_Reflector___toString
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_export, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
-ZEND_END_ARG_INFO()
-
#define arginfo_class_ReflectionMethod_isPublic arginfo_class_Reflector___toString
#define arginfo_class_ReflectionMethod_isPrivate arginfo_class_Reflector___toString
#define arginfo_class_ReflectionClass___clone arginfo_class_Reflector___toString
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_export, 0, 0, 1)
- ZEND_ARG_INFO(0, argument)
- ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass___construct, 0, 0, 1)
ZEND_ARG_INFO(0, argument)
ZEND_END_ARG_INFO()
ZEND_ARG_TYPE_INFO(0, argument, IS_OBJECT, 0)
ZEND_END_ARG_INFO()
-#define arginfo_class_ReflectionObject_export arginfo_class_ReflectionClass_export
-
#define arginfo_class_ReflectionProperty___clone arginfo_class_Reflector___toString
-#define arginfo_class_ReflectionProperty_export arginfo_class_ReflectionMethod_export
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty___construct, 0, 0, 2)
ZEND_ARG_INFO(0, class)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
#define arginfo_class_ReflectionClassConstant___clone arginfo_class_Reflector___toString
-#define arginfo_class_ReflectionClassConstant_export arginfo_class_ReflectionMethod_export
-
#define arginfo_class_ReflectionClassConstant___construct arginfo_class_ReflectionProperty___construct
#define arginfo_class_ReflectionClassConstant___toString arginfo_class_Reflector___toString
#define arginfo_class_ReflectionParameter___clone arginfo_class_Reflector___toString
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionParameter_export, 0, 0, 2)
- ZEND_ARG_INFO(0, function)
- ZEND_ARG_INFO(0, parameter)
- ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionParameter___construct, 0, 0, 2)
ZEND_ARG_INFO(0, function)
ZEND_ARG_INFO(0, parameter)
#define arginfo_class_ReflectionExtension___clone arginfo_class_Reflector___toString
-#define arginfo_class_ReflectionExtension_export arginfo_class_ReflectionFunction_export
-
#define arginfo_class_ReflectionExtension___construct arginfo_class_ReflectionClass_hasMethod
#define arginfo_class_ReflectionExtension___toString arginfo_class_Reflector___toString
#define arginfo_class_ReflectionZendExtension___clone arginfo_class_Reflector___toString
-#define arginfo_class_ReflectionZendExtension_export arginfo_class_ReflectionFunction_export
-
#define arginfo_class_ReflectionZendExtension___construct arginfo_class_ReflectionClass_hasMethod
#define arginfo_class_ReflectionZendExtension___toString arginfo_class_Reflector___toString
$exp = array (
'UMLClass::__clone',
- 'UMLClass::export',
'UMLClass::__construct',
'UMLClass::__toString',
'UMLClass::getName',
--TEST--
-Test usage of ReflectionClassConstant methods __toString(), export(), getName(), getValue(), isPublic(), isPrivate(), isProtected(), getModifiers(), getDeclaringClass() and getDocComment().
+Test usage of ReflectionClassConstant methods __toString(), getName(), getValue(), isPublic(), isPrivate(), isProtected(), getModifiers(), getDeclaringClass() and getDocComment().
--FILE--
<?php
echo "Reflecting on class constant $class::$constant\n\n";
echo "__toString():\n";
var_dump($constInfo->__toString());
- echo "export():\n";
- var_dump(ReflectionClassConstant::export($base, $constant, true));
- echo "export():\n";
- var_dump(ReflectionClassConstant::export($base, $constant, false));
echo "getName():\n";
var_dump($constInfo->getName());
echo "getValue():\n";
__toString():
string(35) "Constant [ public bool PUB ] { 1 }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(35) "Constant [ public bool PUB ] { 1 }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ public bool PUB ] { 1 }
-
-NULL
getName():
string(3) "PUB"
getValue():
__toString():
string(38) "Constant [ protected int PROT ] { 4 }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(38) "Constant [ protected int PROT ] { 4 }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ protected int PROT ] { 4 }
-
-NULL
getName():
string(4) "PROT"
getValue():
__toString():
string(45) "Constant [ private string PRIV ] { keepOut }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(45) "Constant [ private string PRIV ] { keepOut }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ private string PRIV ] { keepOut }
-
-NULL
getName():
string(4) "PRIV"
getValue():
__toString():
string(45) "Constant [ private string PRIV ] { keepOut }
"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-string(45) "Constant [ private string PRIV ] { keepOut }
-"
-export():
-
-Deprecated: Function ReflectionClassConstant::export() is deprecated in %s on line %d
-Constant [ private string PRIV ] { keepOut }
-
-NULL
getName():
string(4) "PRIV"
getValue():
- Static properties [0] {
}
- - Static methods [1] {
- Method [ <internal, deprecated:Reflection> static public method export ] {
-
- - Parameters [2] {
- Parameter #0 [ <required> $argument ]
- Parameter #1 [ <optional> bool $return ]
- }
- }
+ - Static methods [0] {
}
- Properties [1] {
+++ /dev/null
---TEST--
-ReflectionExtension::export()
---CREDITS--
-Gerrit "Remi" te Sligte <remi@wolerized.com>
-Leon Luijkx <leon@phpgg.nl>
---FILE--
-<?php
-ReflectionExtension::export("reflection", true);
-ob_start();
-ReflectionExtension::export("reflection", false);
-$test = ob_get_clean();
-var_dump(empty($test));
-?>
---EXPECTF--
-Deprecated: Function ReflectionExtension::export() is deprecated in %s on line %d
-bool(false)
--TEST--
-ReflectionMethod class __toString() and export() methods
+ReflectionMethod class __toString() method
--FILE--
<?php
echo "Reflecting on method $class::$method()\n\n";
echo "__toString():\n";
var_dump($methodInfo->__toString());
- echo "\nexport():\n";
- var_dump(ReflectionMethod::export($class, $method, true));
echo "\n**********************************\n";
}
__toString():
string(%d) "Method [ <user, inherits TestClass> public method foo ] {
- @@ %s 16 - 18
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user, inherits TestClass> public method foo ] {
- @@ %s 16 - 18
+ @@ %s 14 - 16
}
"
__toString():
string(%d) "Method [ <user> static public method stat ] {
- @@ %s 20 - 22
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> static public method stat ] {
- @@ %s 20 - 22
+ @@ %s 18 - 20
}
"
__toString():
string(%d) "Method [ <user> private method priv ] {
- @@ %s 24 - 26
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> private method priv ] {
- @@ %s 24 - 26
+ @@ %s 22 - 24
}
"
__toString():
string(%d) "Method [ <user> protected method prot ] {
- @@ %s 28 - 28
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> protected method prot ] {
- @@ %s 28 - 28
+ @@ %s 26 - 26
}
"
__toString():
string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
- @@ %s 28 - 28
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
- @@ %s 28 - 28
+ @@ %s 26 - 26
}
"
__toString():
string(%d) "Method [ <user> abstract public method int ] {
- @@ %s 36 - 36
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user> abstract public method int ] {
- @@ %s 36 - 36
+ @@ %s 34 - 34
}
"
}
"
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
-
- - Parameters [2] {
- Parameter #0 [ <required> $class ]
- Parameter #1 [ <required> string $name ]
- }
-}
-"
-
**********************************
**********************************
Reflecting on method TestClass::__destruct()
__toString():
string(%d) "Method [ <user, dtor> public method __destruct ] {
- @@ %s 30 - 30
-}
-"
-
-export():
-
-Deprecated: Function ReflectionMethod::export() is deprecated in %s on line %d
-string(%d) "Method [ <user, dtor> public method __destruct ] {
- @@ %s 30 - 30
+ @@ %s 28 - 28
}
"
+++ /dev/null
---TEST--
-ReflectionParameter::export() with incorrect first parameter
---CREDITS--
-Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
---FILE--
-<?php
-function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
-}
-$reflect = new ReflectionFunction('ReflectionParameterTest');
-$params = $reflect->getParameters();
-try {
- foreach($params as $key => $value) {
- ReflectionParameter::export($reflect, $key);
- }
-}
-catch (ReflectionException $e) {
- echo $e->getMessage() . "\n";
-}
-try {
- foreach($params as $key => $value) {
- ReflectionParameter::export(42, $key);
- }
-}
-catch (ReflectionException $e) {
- echo $e->getMessage() . "\n";
-}
-?>
---EXPECTF--
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-Method ReflectionFunction::__invoke() does not exist
-
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-The parameter class is expected to be either a string, an array(class, method) or a callable object
+++ /dev/null
---TEST--
-ReflectionParameter::export() with incorrect second parameter
---CREDITS--
-Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
---FILE--
-<?php
-function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
-}
-$reflect = new ReflectionFunction('ReflectionParameterTest');
-$params = $reflect->getParameters();
-foreach($params as $key => $value) {
- ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter');
-}
---EXPECTF--
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-
-Fatal error: Uncaught ReflectionException: The parameter specified by its name could not be found in %s:%d
-Stack trace:
-#0 [internal function]: ReflectionParameter->__construct('ReflectionParam...', 'incorrect_param...')
-#1 %s(%d): ReflectionParameter::export('ReflectionParam...', 'incorrect_param...')
-#2 {main}
- thrown in %s on line %d
--TEST--
-Test usage of ReflectionProperty methods __toString(), export(), getName(), isPublic(), isPrivate(), isProtected(), isStatic(), getValue() and setValue().
+Test usage of ReflectionProperty methods __toString(), getName(), isPublic(), isPrivate(), isProtected(), isStatic(), getValue() and setValue().
--FILE--
<?php
echo "Reflecting on property $class::$property\n\n";
echo "__toString():\n";
var_dump($propInfo->__toString());
- echo "export():\n";
- var_dump(ReflectionProperty::export($class, $property, true));
- echo "export():\n";
- var_dump(ReflectionProperty::export($class, $property, false));
echo "getName():\n";
var_dump($propInfo->getName());
echo "isPublic():\n";
__toString():
string(35) "Property [ <default> public $pub ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(35) "Property [ <default> public $pub ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ <default> public $pub ]
-
-NULL
getName():
string(3) "pub"
isPublic():
__toString():
string(33) "Property [ public static $stat ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(33) "Property [ public static $stat ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ public static $stat ]
-
-NULL
getName():
string(4) "stat"
isPublic():
__toString():
string(39) "Property [ <default> protected $prot ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(39) "Property [ <default> protected $prot ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ <default> protected $prot ]
-
-NULL
getName():
string(4) "prot"
isPublic():
__toString():
string(37) "Property [ <default> private $priv ]
"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-string(37) "Property [ <default> private $priv ]
-"
-export():
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property [ <default> private $priv ]
-
-NULL
getName():
string(4) "priv"
isPublic():
+++ /dev/null
---TEST--
-Test ReflectionProperty::__toString() usage.
---FILE--
-<?php
-
-class TestClass {
- public $proper = 5;
-}
-
-echo new ReflectionProperty('TestClass', 'proper');
-
-?>
---EXPECT--
-Property [ <default> public $proper ]
+++ /dev/null
---TEST--
-Test ReflectionProperty::export() errors.
---FILE--
-<?php
-
-class TestClass {
-}
-
-$a = 5;
-
-echo "Non-existent class:\n";
-try {
- ReflectionProperty::export("NonExistentClass", "prop", true);
-}
-catch(Exception $e) {
- echo $e->getMessage();
-}
-
-echo "\n\nWrong property parameter type:\n";
-try {
- ReflectionProperty::export($a, 'TestClass', false);
-}
-catch(ReflectionException $e) {
- echo $e->getMessage();
-}
-
-echo "\n\nNon-existent property:\n";
-try {
- ReflectionProperty::export('TestClass', "nonExistentProperty", true);
-}
-catch(Exception $e) {
- echo $e->getMessage();
-}
-
-?>
---EXPECTF--
-Non-existent class:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Class NonExistentClass does not exist
-
-Wrong property parameter type:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-The parameter class is expected to be either a string or an object
-
-Non-existent property:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-Property TestClass::$nonExistentProperty does not exist
var_dump($reflection->getName());
var_dump($reflection->getURL());
var_dump($reflection->getVersion() === PHP_VERSION);
-var_dump(gettype($reflection->export('Zend OPcache', true)) === 'string');
?>
--EXPECTF--
string(17) "Zend Technologies"
string(12) "Zend OPcache"
string(20) "http://www.zend.com/"
bool(true)
-
-Deprecated: Function ReflectionZendExtension::export() is deprecated in %s on line %d
-bool(true)
+++ /dev/null
---TEST--
-Bug #46205 (Closure - Memory leaks when ReflectionException is thrown)
---FILE--
-<?php
-$x = new reflectionmethod('reflectionparameter', 'export');
-$y = function() { };
-
-try {
- $x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1));
-} catch (Exception $e) { }
-?>
-ok
---EXPECTF--
-Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
-ok
+++ /dev/null
---TEST--
-Bug #37565 (Using reflection::export with simplexml causing a crash)
---SKIPIF--
-<?php if (!extension_loaded("simplexml")) print "skip"; ?>
---FILE--
-<?php
-
-function my_error_handler($errno, $errstr, $errfile, $errline) {
- echo "Error: $errstr\n";
-}
-
-set_error_handler('my_error_handler');
-
-class Setting extends ReflectionObject
-{
-}
-
-try {
- Reflection::export(simplexml_load_string('<test/>', 'Setting'));
-} catch (Error $e) {
- my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
-}
-
-try {
- Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
-} catch (Error $e) {
- my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
-}
-
-?>
---EXPECT--
-Error: simplexml_load_string() expects argument #2 ($class_name) to be a class name derived from SimpleXMLElement, 'Setting' given
-Error: simplexml_load_file() expects argument #2 ($class_name) to be a class name derived from SimpleXMLElement, 'Setting' given