intern = Z_REFLECTION_P(ZEND_THIS); \
if (intern->ptr == NULL) { \
if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { \
- return; \
+ RETURN_THROWS(); \
} \
zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object"); \
RETURN_THROWS(); \
if (result == FAILURE) {
_DO_THROW("Invocation of method __toString() failed");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) == IS_UNDEF) {
/* Create object */
if (object_init_ex(&reflector, ce_ptr) == FAILURE) {
_DO_THROW("Could not create reflector");
- return;
+ RETURN_THROWS();
}
/* Call __construct() */
if (result == FAILURE) {
zval_ptr_dtor(&reflector);
_DO_THROW("Could not create reflector");
- return;
+ RETURN_THROWS();
}
reflection_export_impl(return_value, &reflector, return_output);
if (fptr == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Function %s() does not exist", ZSTR_VAL(fname));
- return;
+ RETURN_THROWS();
}
}
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
ex = ((zend_generator *) Z_OBJ_P(generator))->execute_data;
if (!ex) {
_DO_THROW("Cannot create ReflectionGenerator based on a terminated Generator");
- return;
+ RETURN_THROWS();
}
intern->ref_type = REF_TYPE_GENERATOR;
#define REFLECTION_CHECK_VALID_GENERATOR(ex) \
if (!ex) { \
_DO_THROW("Cannot fetch information from a terminated Generator"); \
- return; \
+ RETURN_THROWS(); \
}
/* {{{ proto public array ReflectionGenerator::getTrace($options = DEBUG_BACKTRACE_PROVIDE_OBJECT) */
if (!fptr) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Function %s() does not exist", Z_STRVAL_P(reference));
- return;
+ RETURN_THROWS();
}
ce = fptr->common.scope;
}
|| ((method = zend_hash_index_find(Z_ARRVAL_P(reference), 1)) == NULL))
{
_DO_THROW("Expected array($object, $method) or array($classname, $method)");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(classref) == IS_OBJECT) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", ZSTR_VAL(name));
zend_string_release(name);
- return;
+ RETURN_THROWS();
}
zend_string_release(name);
}
zend_string_release(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), Z_STRVAL_P(method));
- return;
+ RETURN_THROWS();
}
zend_string_release(name);
zend_string_release(lcname);
} else if ((fptr = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), ZEND_INVOKE_FUNC_NAME);
- return;
+ RETURN_THROWS();
}
}
break;
default:
_DO_THROW("The parameter class is expected to be either a string, an array(class, method) or a callable object");
- return;
+ RETURN_THROWS();
}
/* Now, search for the parameter */
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'self' as type hint but function is not a class member!");
- return;
+ RETURN_THROWS();
}
} else if (0 == zend_binary_strcasecmp(ZSTR_VAL(class_name), ZSTR_LEN(class_name), "parent", sizeof("parent")- 1)) {
ce = param->fptr->common.scope;
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'parent' as type hint but function is not a class member!");
- return;
+ RETURN_THROWS();
}
if (!ce->parent) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'parent' as type hint although class does not have a parent!");
- return;
+ RETURN_THROWS();
}
ce = ce->parent;
} else {
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", ZSTR_VAL(class_name));
- return;
+ RETURN_THROWS();
}
}
zend_reflection_class_factory(ce, return_value);
if ((tmp = strstr(name_str, "::")) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invalid method name %s", name_str);
- return;
+ RETURN_THROWS();
}
classname = &ztmp;
tmp_len = tmp - name_str;
if (classname == &ztmp) {
zval_ptr_dtor_str(&ztmp);
}
- return;
+ RETURN_THROWS();
}
break;
zval_ptr_dtor_str(&ztmp);
}
_DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ RETURN_THROWS();
}
if (classname == &ztmp) {
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), name_str);
- return;
+ RETURN_THROWS();
}
efree(lcname);
if (!instanceof_function(Z_OBJCE_P(obj), mptr->common.scope)) {
_DO_THROW("Given object is not an instance of the class this method was declared in");
- return;
+ RETURN_THROWS();
}
/* This is an original closure object and __invoke is to be called. */
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke abstract method %s::%s()",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name),
ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (variadic) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke non static method %s::%s() without an object",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
obj_ce = Z_OBJCE_P(object);
efree(params);
}
_DO_THROW("Given object is not an instance of the class this method was declared in");
- return;
+ RETURN_THROWS();
}
}
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
if (!mptr->common.prototype) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
reflection_method_factory(mptr->common.prototype->common.scope, mptr->common.prototype, NULL, return_value);
if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(classname));
- return;
+ RETURN_THROWS();
}
break;
default:
_DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ RETURN_THROWS();
}
if ((constant = zend_hash_find_ptr(&ce->constants_table, constname)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Class Constant %s::%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(constname));
- return;
+ RETURN_THROWS();
}
intern->ptr = constant;
if (!EG(exception)) {
zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", Z_STRVAL_P(argument));
}
- return;
+ RETURN_THROWS();
}
ZVAL_STR_COPY(reflection_prop_name(object), ce->name);
zend_clear_exception();
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- return;
+ RETURN_THROWS();
}
if (Z_ISREF_P(variable_ptr)) {
zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", ZSTR_VAL(classname));
}
zend_string_release_ex(classname, 0);
- return;
+ RETURN_THROWS();
}
zend_string_release_ex(classname, 0);
if (!instanceof_function(ce, ce2)) {
zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ZSTR_VAL(ce2->name), str_name, ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
ce = ce2;
if (ce->type == ZEND_INTERNAL_CLASS
&& ce->create_object != NULL && (ce->ce_flags & ZEND_ACC_FINAL)) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
object_init_ex(return_value, ce);
if ((class_ce = zend_lookup_class(Z_STR_P(class_name))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(class_name));
- return;
+ RETURN_THROWS();
}
break;
case IS_OBJECT:
argument = Z_REFLECTION_P(class_name);
if (argument->ptr == NULL) {
zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
- return;
+ RETURN_THROWS();
}
class_ce = argument->ptr;
break;
default:
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter one must either be a string or a ReflectionClass object");
- return;
+ RETURN_THROWS();
}
RETURN_BOOL((ce != class_ce && instanceof_function(ce, class_ce)));
if ((interface_ce = zend_lookup_class(Z_STR_P(interface))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Interface %s does not exist", Z_STRVAL_P(interface));
- return;
+ RETURN_THROWS();
}
break;
case IS_OBJECT:
argument = Z_REFLECTION_P(interface);
if (argument->ptr == NULL) {
zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
- return;
+ RETURN_THROWS();
}
interface_ce = argument->ptr;
break;
default:
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter one must either be a string or a ReflectionClass object");
- return;
+ RETURN_THROWS();
}
if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"%s is not an interface", ZSTR_VAL(interface_ce->name));
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(instanceof_function(ce, interface_ce));
}
if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(classname));
- return;
+ RETURN_THROWS();
}
break;
default:
_DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ RETURN_THROWS();
}
property_info = zend_hash_find_ptr(&ce->properties_info, name);
}
if (dynam_prop == 0) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- return;
+ RETURN_THROWS();
}
}
name = _default_load_name(ZEND_THIS);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ RETURN_THROWS();
}
if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
/* TODO: Should this always use intern->ce? */
if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- return;
+ RETURN_THROWS();
}
member_p = zend_read_property_ex(intern->ce, object, ref->unmangled_name, 0, &rv);
name = _default_load_name(ZEND_THIS);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ RETURN_THROWS();
}
if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
name = _default_load_name(getThis());
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ RETURN_THROWS();
}
if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
/* TODO: Should this always use intern->ce? */
if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- return;
+ RETURN_THROWS();
}
old_scope = EG(fake_scope);
free_alloca(lcname, use_heap);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Extension %s does not exist", name_str);
- return;
+ RETURN_THROWS();
}
free_alloca(lcname, use_heap);
ZVAL_STRING(reflection_prop_name(object), module->name);
if (!extension) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Zend Extension %s does not exist", name_str);
- return;
+ RETURN_THROWS();
}
ZVAL_STRING(reflection_prop_name(object), extension->name);
intern->ptr = extension;
if (!item) {
_DO_THROW("Array key not found");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(item) != IS_REFERENCE || is_ignorable_reference(ht, item)) {
intern = Z_REFLECTION_P(getThis());
if (Z_TYPE(intern->obj) != IS_REFERENCE) {
_DO_THROW("Corrupted ReflectionReference object");
- return;
+ RETURN_THROWS();
}
if (!REFLECTION_G(key_initialized)) {