summaryrefslogtreecommitdiff
path: root/Zend/zend_reflection_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_reflection_api.c')
-rw-r--r--Zend/zend_reflection_api.c120
1 files changed, 53 insertions, 67 deletions
diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c
index fa001dc9b9..9677a37f68 100644
--- a/Zend/zend_reflection_api.c
+++ b/Zend/zend_reflection_api.c
@@ -54,11 +54,11 @@ zend_class_entry *reflection_extension_ptr;
/* Exception throwing macro */
#define _DO_THROW(msg) \
- zend_throw_exception(reflection_exception_ptr, msg, 0 TSRMLS_CC); \
+ zend_throw_exception(U_CLASS_ENTRY(reflection_exception_ptr), msg, 0 TSRMLS_CC); \
return; \
#define RETURN_ON_EXCEPTION \
- if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) { \
+ if (EG(exception) && Z_OBJCE_P(EG(exception)) == U_CLASS_ENTRY(reflection_exception_ptr)) { \
return; \
}
@@ -870,7 +870,7 @@ ZEND_API void zend_reflection_class_factory(zend_class_entry *ce, zval *object T
} else {
ZVAL_STRINGL(name, ce->name, ce->name_length, 1);
}
- reflection_instanciate(reflection_class_ptr, object TSRMLS_CC);
+ reflection_instanciate(U_CLASS_ENTRY(reflection_class_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = ce;
intern->free_ptr = 0;
@@ -896,7 +896,7 @@ static void reflection_extension_factory(zval *object, char *name_str TSRMLS_DC)
}
free_alloca(lcname);
- reflection_instanciate(reflection_extension_ptr, object TSRMLS_CC);
+ reflection_instanciate(U_CLASS_ENTRY(reflection_extension_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
MAKE_STD_ZVAL(name);
ZVAL_STRINGL(name, module->name, name_len, 1);
@@ -924,7 +924,7 @@ static void reflection_parameter_factory(zend_function *fptr, struct _zend_arg_i
} else {
ZVAL_NULL(name);
}
- reflection_instanciate(reflection_parameter_ptr, object TSRMLS_CC);
+ reflection_instanciate(U_CLASS_ENTRY(reflection_parameter_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
reference = (parameter_reference*) emalloc(sizeof(parameter_reference));
reference->arg_info = arg_info;
@@ -951,7 +951,7 @@ static void reflection_function_factory(zend_function *function, zval *object TS
ZVAL_STRING(name, function->common.function_name, 1);
}
- reflection_instanciate(reflection_function_ptr, object TSRMLS_CC);
+ reflection_instanciate(U_CLASS_ENTRY(reflection_function_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = function;
intern->free_ptr = 0;
@@ -976,7 +976,7 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
ZVAL_STRING(name, method->common.function_name, 1);
ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
}
- reflection_instanciate(reflection_method_ptr, object TSRMLS_CC);
+ reflection_instanciate(U_CLASS_ENTRY(reflection_method_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = method;
intern->free_ptr = 0;
@@ -1023,7 +1023,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
}
- reflection_instanciate(reflection_property_ptr, object TSRMLS_CC);
+ reflection_instanciate(U_CLASS_ENTRY(reflection_property_ptr), object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
reference = (property_reference*) emalloc(sizeof(property_reference));
reference->ce = ce;
@@ -1107,7 +1107,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
params[1] = &output_ptr;
ZVAL_STRINGL(&fname, "export", sizeof("export") - 1, 0);
- fci.function_table = &reflection_ptr->function_table;
+ fci.function_table = &U_CLASS_ENTRY(reflection_ptr)->function_table;
fci.function_name = &fname;
fci.object_pp = NULL;
fci.retval_ptr_ptr = &retval_ptr;
@@ -1150,7 +1150,7 @@ ZEND_METHOD(reflection, export)
int result;
zend_bool return_output = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, U_CLASS_ENTRY(reflector_ptr), &return_output) == FAILURE) {
return;
}
@@ -1222,7 +1222,7 @@ ZEND_METHOD(reflection, getModifierNames)
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);
+ _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_function_ptr), 1);
}
/* }}} */
@@ -1252,7 +1252,7 @@ ZEND_METHOD(reflection_function, __construct)
lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len);
if (zend_u_hash_find(EG(function_table), type, lcname, lcname_len + 1, (void **)&fptr) == FAILURE) {
efree(lcname);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Function %R() does not exist", type, name_str);
return;
}
@@ -1446,7 +1446,7 @@ ZEND_METHOD(reflection_function, invoke)
efree(params);
if (result == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Invocation of function %v() failed", fptr->common.function_name);
return;
}
@@ -1510,7 +1510,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
efree(params);
if (result == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Invocation of function %v() failed", fptr->common.function_name);
return;
}
@@ -1594,7 +1594,7 @@ ZEND_METHOD(reflection_function, getParameters)
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);
+ _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_parameter_ptr), 2);
}
/* }}} */
@@ -1633,7 +1633,7 @@ ZEND_METHOD(reflection_parameter, __construct)
lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_STRVAL_P(reference), Z_STRLEN_P(reference), 1, &lcname_len);
if (zend_u_hash_find(EG(function_table), Z_TYPE_P(reference), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) {
efree(lcname);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Function %R() does not exist", Z_TYPE_P(reference), Z_STRVAL_P(reference));
return;
}
@@ -1659,7 +1659,7 @@ ZEND_METHOD(reflection_parameter, __construct)
} else {
convert_to_text_ex(classref);
if (zend_u_lookup_class(Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_UNILEN_PP(classref), &pce TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Class %R does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref));
return;
}
@@ -1670,7 +1670,7 @@ ZEND_METHOD(reflection_parameter, __construct)
lcname = zend_u_str_case_fold(Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method), 1, &lcname_len);
if (zend_u_hash_find(&ce->function_table, Z_TYPE_PP(method), lcname, lcname_len + 1, (void **) &fptr) == FAILURE) {
efree(lcname);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Method %R::%R() does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_TYPE_PP(method), Z_UNIVAL_PP(method));
return;
}
@@ -1775,7 +1775,7 @@ ZEND_METHOD(reflection_parameter, getClass)
if (zend_u_hash_find(EG(class_table), UG(unicode)?IS_UNICODE:IS_STRING, lcname, lcname_len + 1, (void **) &pce) == FAILURE) {
efree(lcname);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Class %v does not exist", param->arg_info->class_name);
return;
}
@@ -1881,16 +1881,16 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
if (param->fptr->type != ZEND_USER_FUNCTION)
{
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions");
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Cannot determine default value for internal functions");
return;
}
if (param->offset < param->required) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional");
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Parameter is not optional");
return;
}
precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error");
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Internal error");
return;
}
@@ -1905,7 +1905,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
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);
+ _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_method_ptr), 2);
}
/* }}} */
@@ -1940,7 +1940,7 @@ ZEND_METHOD(reflection_method, __construct)
case IS_STRING:
case IS_UNICODE:
if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Class %v does not exist", Z_UNIVAL_P(classname));
return;
}
@@ -1968,7 +1968,7 @@ ZEND_METHOD(reflection_method, __construct)
if (zend_u_hash_find(&ce->function_table, type, lcname, lcname_len + 1, (void **) &mptr) == FAILURE) {
efree(lcname);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Method %v::%R() does not exist", ce->name, type, name_str);
return;
}
@@ -2030,11 +2030,11 @@ ZEND_METHOD(reflection_method, invoke)
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) ||
(mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Trying to invoke abstract method %v::%v()",
mptr->common.scope->name, mptr->common.function_name);
} else {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Trying to invoke %s method %v::%v() from scope %v",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
mptr->common.scope->name, mptr->common.function_name,
@@ -2095,7 +2095,7 @@ ZEND_METHOD(reflection_method, invoke)
efree(params);
if (result == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name);
return;
}
@@ -2133,11 +2133,11 @@ ZEND_METHOD(reflection_method, invokeArgs)
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) ||
(mptr->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Trying to invoke abstract method %v::%v",
mptr->common.scope->name, mptr->common.function_name);
} else {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Trying to invoke %s method %v::%v from scope %v",
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
mptr->common.scope->name, mptr->common.function_name,
@@ -2164,7 +2164,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
} else {
if (!object) {
efree(params);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Trying to invoke non static method %v::%v without an object",
mptr->common.scope->name, mptr->common.function_name);
return;
@@ -2199,7 +2199,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
efree(params);
if (result == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Invocation of method %v::%v() failed", mptr->common.scope->name, mptr->common.function_name);
return;
}
@@ -2319,7 +2319,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
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_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_class_ptr), 1);
}
/* }}} */
@@ -2365,7 +2365,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
convert_to_string_ex(&argument);
if (zend_u_lookup_class(Z_TYPE_P(argument), Z_UNIVAL_P(argument), Z_UNILEN_P(argument), &ce TSRMLS_CC) == FAILURE) {
if (!EG(exception)) {
- zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument));
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument));
}
return;
}
@@ -2432,7 +2432,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
if (def_value) {
RETURN_ZVAL(def_value, 1, 0);
} else {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Class %s does not have a property named %s", ce->name, name);
}
return;
@@ -2463,7 +2463,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zend_update_class_constants(ce TSRMLS_CC);
variable_ptr = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC);
if (!variable_ptr) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Class %s does not have a property named %s", ce->name, name);
return;
}
@@ -2709,7 +2709,7 @@ ZEND_METHOD(reflection_class, getMethod)
efree(lc_name);
} else {
efree(lc_name);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Method %R does not exist", type, name);
return;
}
@@ -2813,7 +2813,7 @@ ZEND_METHOD(reflection_class, getProperty)
if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) {
reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
} else {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Property %s does not exist", name);
return;
}
@@ -3043,7 +3043,7 @@ ZEND_METHOD(reflection_class, newInstance)
zend_fcall_info_cache fcc;
if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name);
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC, "Access to non-public constructor of class %v", ce->name);
return;
}
@@ -3145,14 +3145,14 @@ ZEND_METHOD(reflection_class, isSubclassOf)
case IS_STRING:
case IS_UNICODE:
if (zend_u_lookup_class(Z_TYPE_P(class_name), Z_UNIVAL_P(class_name), Z_UNILEN_P(class_name), &pce TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Interface %s does not exist", Z_STRVAL_P(class_name));
return;
}
class_ce = *pce;
break;
case IS_OBJECT:
- if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr TSRMLS_CC)) {
+ if (instanceof_function(Z_OBJCE_P(class_name), U_CLASS_ENTRY(reflection_class_ptr) TSRMLS_CC)) {
argument = (reflection_object *) zend_object_store_get_object(class_name TSRMLS_CC);
if (argument == NULL || argument->ptr == NULL) {
zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
@@ -3163,7 +3163,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
}
/* no break */
default:
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Parameter one must either be a string or a ReflectionClass object");
return;
}
@@ -3192,14 +3192,14 @@ ZEND_METHOD(reflection_class, implementsInterface)
case IS_STRING:
case IS_UNICODE:
if (zend_u_lookup_class(Z_TYPE_P(interface), Z_UNIVAL_P(interface), Z_UNILEN_P(interface), &pce TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Interface %s does not exist", Z_STRVAL_P(interface));
return;
}
interface_ce = *pce;
break;
case IS_OBJECT:
- if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr TSRMLS_CC)) {
+ if (instanceof_function(Z_OBJCE_P(interface), U_CLASS_ENTRY(reflection_class_ptr) TSRMLS_CC)) {
argument = (reflection_object *) zend_object_store_get_object(interface TSRMLS_CC);
if (argument == NULL || argument->ptr == NULL) {
zend_error(E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
@@ -3210,13 +3210,13 @@ ZEND_METHOD(reflection_class, implementsInterface)
}
/* no break */
default:
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Parameter one must either be a string or a ReflectionClass object");
return;
}
if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Interface %v is a Class", interface_ce->name);
return;
}
@@ -3276,7 +3276,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
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);
+ _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_object_ptr), 1);
}
/* }}} */
@@ -3292,7 +3292,7 @@ ZEND_METHOD(reflection_object, __construct)
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);
+ _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_property_ptr), 2);
}
/* }}} */
@@ -3325,7 +3325,7 @@ ZEND_METHOD(reflection_property, __construct)
case IS_STRING:
case IS_UNICODE:
if (zend_u_lookup_class(Z_TYPE_P(classname), Z_UNIVAL_P(classname), Z_UNILEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Class %s does not exist", Z_STRVAL_P(classname));
return;
}
@@ -3342,7 +3342,7 @@ ZEND_METHOD(reflection_property, __construct)
}
if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) {
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Property %v::$%s does not exist", ce->name, name_str);
return;
}
@@ -3614,7 +3614,7 @@ ZEND_METHOD(reflection_property, getDocComment)
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);
+ _reflection_export(INTERNAL_FUNCTION_PARAM_PASSTHRU, U_CLASS_ENTRY(reflection_extension_ptr), 1);
}
/* }}} */
@@ -3643,7 +3643,7 @@ ZEND_METHOD(reflection_extension, __construct)
zend_str_tolower_copy(lcname, name_str, name_len);
if (zend_hash_find(&module_registry, lcname, name_len + 1, (void **)&module) == FAILURE) {
free_alloca(lcname);
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Extension %s does not exist", name_str);
return;
}
@@ -4015,7 +4015,7 @@ static void _reflection_write_property(zval *object, zval *member, zval *value T
&& (ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "name", sizeof("name")-1) ||
ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member), "class", sizeof("class")-1)))
{
- zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
+ zend_throw_exception_ex(U_CLASS_ENTRY(reflection_exception_ptr), 0 TSRMLS_CC,
"Cannot set read-only property %v::$%R", Z_OBJCE_P(object)->name, Z_TYPE_P(member), Z_UNIVAL_P(member));
}
else
@@ -4106,20 +4106,6 @@ ZEND_API void zend_register_reflection_api(TSRMLS_D) {
}
/* }}} */
-void init_reflection_api(TSRMLS_D)
-{
- reflection_exception_ptr = zend_get_named_class_entry("ReflectionException", sizeof("ReflectionException")-1 TSRMLS_CC);
- reflection_ptr = zend_get_named_class_entry("Reflection", sizeof("Reflection")-1 TSRMLS_CC);
- reflector_ptr = zend_get_named_class_entry("Reflector", sizeof("Reflector")-1 TSRMLS_CC);
- reflection_function_ptr = zend_get_named_class_entry("ReflectionFunction", sizeof("ReflectionFunction")-1 TSRMLS_CC);
- reflection_parameter_ptr = zend_get_named_class_entry("ReflectionParameter", sizeof("ReflectionParameter")-1 TSRMLS_CC);
- reflection_method_ptr = zend_get_named_class_entry("ReflectionMethod", sizeof("ReflectionMethod")-1 TSRMLS_CC);
- reflection_class_ptr = zend_get_named_class_entry("ReflectionClass", sizeof("ReflectionClass")-1 TSRMLS_CC);
- reflection_object_ptr = zend_get_named_class_entry("ReflectionObject", sizeof("ReflectionObject")-1 TSRMLS_CC);
- reflection_property_ptr = zend_get_named_class_entry("ReflectionProperty", sizeof("ReflectionProperty")-1 TSRMLS_CC);
- reflection_extension_ptr = zend_get_named_class_entry("ReflectionExtension", sizeof("ReflectionExtension")-1 TSRMLS_CC);
-}
-
/*
* Local variables:
* tab-width: 4