From 907476f34c0dbe34e311c4a99cc07eb40fd2954b Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Sun, 5 Jul 2015 02:37:49 -0500 Subject: Convert E_ERROR to thrown Error in extensions --- ext/reflection/php_reflection.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 463cbd6a3a..4684954567 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -88,7 +88,7 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) #define METHOD_NOTSTATIC(ce) \ if (!Z_OBJ(EX(This)) || !instanceof_function(Z_OBJCE(EX(This)), ce)) { \ - php_error_docref(NULL, E_ERROR, "%s() cannot be called statically", get_active_function_name()); \ + zend_throw_error(zend_ce_error, "%s() cannot be called statically", get_active_function_name()); \ return; \ } \ @@ -106,7 +106,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) intern = Z_REFLECTION_P(getThis()); \ if (intern == NULL || intern->ptr == NULL) { \ RETURN_ON_EXCEPTION \ - php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the reflection object"); \ + zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the reflection object"); \ + return; \ } \ #define GET_REFLECTION_OBJECT_PTR(target) \ @@ -1473,7 +1474,8 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { return NULL; } - php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the reflection object"); + zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the reflection object"); + return NULL; } param = intern->ptr; @@ -4955,8 +4957,8 @@ ZEND_METHOD(reflection_class, isSubclassOf) if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr)) { argument = Z_REFLECTION_P(class_name); if (argument == NULL || argument->ptr == NULL) { - php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object"); - /* Bails out */ + zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the argument's reflection object"); + return; } class_ce = argument->ptr; break; @@ -4999,8 +5001,8 @@ ZEND_METHOD(reflection_class, implementsInterface) if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr)) { argument = Z_REFLECTION_P(interface); if (argument == NULL || argument->ptr == NULL) { - php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object"); - /* Bails out */ + zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the argument's reflection object"); + return; } interface_ce = argument->ptr; break; @@ -5395,7 +5397,7 @@ ZEND_METHOD(reflection_property, getValue) return; } if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) { - php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); + zend_throw_error(zend_ce_error, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); /* Bails out */ } ZVAL_DUP(return_value, &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]); @@ -5447,8 +5449,8 @@ ZEND_METHOD(reflection_property, setValue) } if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) { - php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); - /* Bails out */ + zend_throw_error(zend_ce_error, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); + return; } variable_ptr = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]; if (variable_ptr != value) { -- cgit v1.2.1