summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-12-31 19:36:27 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2021-01-01 14:46:28 +0100
commit82f9e004da91311dbe94e9a867f7fd6e4574adec (patch)
treec085c9d01dae8062249dcdef8244653d376050fe
parent2e854791afa6bbe1c93705047c82630f49f64325 (diff)
downloadphp-git-82f9e004da91311dbe94e9a867f7fd6e4574adec.tar.gz
Fix ReflectionClass::getConstants() stub
If `zval_update_constant_ex()` fails, an exception has already been thrown, so we clarify that in the implementation as well. Closes GH-6557.
-rw-r--r--ext/reflection/php_reflection.c3
-rw-r--r--ext/reflection/php_reflection.stub.php2
-rw-r--r--ext/reflection/php_reflection_arginfo.h2
3 files changed, 3 insertions, 4 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index dfa084caa5..a782a3ef0f 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4446,8 +4446,7 @@ ZEND_METHOD(ReflectionClass, getConstants)
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, constant) {
if (UNEXPECTED(zval_update_constant_ex(&constant->value, ce) != SUCCESS)) {
- zend_array_destroy(Z_ARRVAL_P(return_value));
- RETURN_NULL();
+ RETURN_THROWS();
}
if (Z_ACCESS_FLAGS(constant->value) & filter) {
diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php
index 7e2f061142..d12d10bd81 100644
--- a/ext/reflection/php_reflection.stub.php
+++ b/ext/reflection/php_reflection.stub.php
@@ -259,7 +259,7 @@ class ReflectionClass implements Reflector
/** @return bool */
public function hasConstant(string $name) {}
- /** @return array|null */
+ /** @return array */
public function getConstants(?int $filter = null) {}
/** @return ReflectionClassConstant[] */
diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h
index 591a160ed3..ba524b4f6d 100644
--- a/ext/reflection/php_reflection_arginfo.h
+++ b/ext/reflection/php_reflection_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ec7607b8087ddd4297bf51cc4072465d2a0f27af */
+ * Stub hash: 6849bff1f2b343df4bd7e6da9c8adc555731e2d3 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)