summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-02-28 15:46:58 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-02-28 15:46:58 +0100
commitc5d9a44798406f52db1b334be68c8ffd4a88ad4c (patch)
treedc345f166dde47efe4b3919423e09dc094932cf8 /ext/reflection/php_reflection.c
parent29f15a1333ad16b25b6da83d1cd4c7a43e984ca8 (diff)
parentf4ded492c922e44e9d61691de584a07e1b49bb58 (diff)
downloadphp-git-c5d9a44798406f52db1b334be68c8ffd4a88ad4c.tar.gz
Merge branch 'PHP-7.4'
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 1f825e65d4..0510994b89 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -86,8 +86,7 @@ PHPAPI zend_class_entry *reflection_reference_ptr;
/* Exception throwing macro */
#define _DO_THROW(msg) \
- zend_throw_exception(reflection_exception_ptr, msg, 0); \
- return;
+ zend_throw_exception(reflection_exception_ptr, msg, 0);
#define GET_REFLECTION_OBJECT() do { \
intern = Z_REFLECTION_P(ZEND_THIS); \
@@ -1302,6 +1301,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
/* Create object */
if (object_init_ex(&reflector, ce_ptr) == FAILURE) {
_DO_THROW("Could not create reflector");
+ return;
}
/* Call __construct() */
@@ -1329,6 +1329,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
if (result == FAILURE) {
zval_ptr_dtor(&reflector);
_DO_THROW("Could not create reflector");
+ return;
}
/* Call static reflection::export */
@@ -1350,6 +1351,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
zval_ptr_dtor(&reflector);
zval_ptr_dtor(&retval);
_DO_THROW("Could not execute reflection::export()");
+ return;
}
if (return_output) {
@@ -1436,7 +1438,7 @@ ZEND_METHOD(reflection, export)
if (result == FAILURE) {
_DO_THROW("Invocation of method __toString() failed");
- /* Returns from this function */
+ return;
}
if (Z_TYPE(retval) == IS_UNDEF) {
@@ -2283,7 +2285,7 @@ ZEND_METHOD(reflection_parameter, __construct)
|| ((method = zend_hash_index_find(Z_ARRVAL_P(reference), 1)) == NULL))
{
_DO_THROW("Expected array($object, $method) or array($classname, $method)");
- /* returns out of this function */
+ return;
}
if (Z_TYPE_P(classref) == IS_OBJECT) {
@@ -2331,7 +2333,7 @@ ZEND_METHOD(reflection_parameter, __construct)
default:
_DO_THROW("The parameter class is expected to be either a string, an array(class, method) or a callable object");
- /* returns out of this function */
+ return;
}
/* Now, search for the parameter */
@@ -2351,7 +2353,7 @@ ZEND_METHOD(reflection_parameter, __construct)
zval_ptr_dtor(reference);
}
_DO_THROW("The parameter specified by its offset could not be found");
- /* returns out of this function */
+ return;
}
} else {
uint32_t i;
@@ -2388,7 +2390,7 @@ ZEND_METHOD(reflection_parameter, __construct)
zval_ptr_dtor(reference);
}
_DO_THROW("The parameter specified by its name could not be found");
- /* returns out of this function */
+ return;
}
}
@@ -2973,7 +2975,7 @@ ZEND_METHOD(reflection_method, __construct)
zval_ptr_dtor_str(&ztmp);
}
_DO_THROW("The parameter class is expected to be either a string or an object");
- /* returns out of this function */
+ return;
}
if (classname == &ztmp) {
@@ -3041,7 +3043,7 @@ ZEND_METHOD(reflection_method, getClosure)
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");
- /* Returns from this function */
+ return;
}
/* This is an original closure object and __invoke is to be called. */
@@ -3130,7 +3132,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
efree(params);
}
_DO_THROW("Given object is not an instance of the class this method was declared in");
- /* Returns from this function */
+ return;
}
}
@@ -3513,7 +3515,7 @@ ZEND_METHOD(reflection_class_constant, __construct)
default:
_DO_THROW("The parameter class is expected to be either a string or an object");
- /* returns out of this function */
+ return;
}
if ((constant = zend_hash_find_ptr(&ce->constants_table, constname)) == NULL) {
@@ -5231,7 +5233,7 @@ ZEND_METHOD(reflection_property, __construct)
default:
_DO_THROW("The parameter class is expected to be either a string or an object");
- /* returns out of this function */
+ return;
}
property_info = zend_hash_find_ptr(&ce->properties_info, name);
@@ -5428,7 +5430,7 @@ ZEND_METHOD(reflection_property, getValue)
if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- /* Returns from this function */
+ return;
}
member_p = zend_read_property_ex(intern->ce, object, ref->unmangled_name, 0, &rv);
@@ -5515,7 +5517,7 @@ ZEND_METHOD(reflection_property, isInitialized)
if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- /* Returns from this function */
+ return;
}
old_scope = EG(fake_scope);
@@ -6178,6 +6180,7 @@ ZEND_METHOD(reflection_reference, fromArrayElement)
if (!item) {
_DO_THROW("Array key not found");
+ return;
}
if (Z_TYPE_P(item) != IS_REFERENCE) {
@@ -6207,6 +6210,7 @@ ZEND_METHOD(reflection_reference, getId)
intern = Z_REFLECTION_P(getThis());
if (Z_TYPE(intern->obj) != IS_REFERENCE) {
_DO_THROW("Corrupted ReflectionReference object");
+ return;
}
if (!REFLECTION_G(key_initialized)) {