summaryrefslogtreecommitdiff
path: root/ext/reflection
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-03-22 12:41:34 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-03-22 12:41:34 +0100
commit9457cfca373f9e55eea8cf13ca39b4102003e7a8 (patch)
tree3e200a6635303eaa19250211253d120675f7b284 /ext/reflection
parentd373c11e710b525feb6373629e3d1ebffef2dd5b (diff)
parent620a753185e575c8d48779764f376f6227b6e293 (diff)
downloadphp-git-9457cfca373f9e55eea8cf13ca39b4102003e7a8.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
Diffstat (limited to 'ext/reflection')
-rw-r--r--ext/reflection/php_reflection.c18
-rw-r--r--ext/reflection/tests/bug77772.phpt22
2 files changed, 36 insertions, 4 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 4c6f6f9aa4..5f8faa39b7 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4154,12 +4154,17 @@ ZEND_METHOD(reflection_class, getMethods)
reflection_object *intern;
zend_class_entry *ce;
zend_function *mptr;
- zend_long filter = ZEND_ACC_PPP_MASK | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL | ZEND_ACC_STATIC;
+ zend_long filter = 0;
+ zend_bool filter_is_null = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &filter) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) {
return;
}
+ if (filter_is_null) {
+ filter = ZEND_ACC_PPP_MASK | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL | ZEND_ACC_STATIC;
+ }
+
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -4334,11 +4339,16 @@ ZEND_METHOD(reflection_class, getProperties)
zend_class_entry *ce;
zend_string *key;
zend_property_info *prop_info;
- zend_long filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC;
+ zend_long filter = 0;
+ zend_bool filter_is_null = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &filter) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) {
return;
}
+
+ if (filter_is_null) {
+ filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC;
+ }
GET_REFLECTION_OBJECT_PTR(ce);
diff --git a/ext/reflection/tests/bug77772.phpt b/ext/reflection/tests/bug77772.phpt
new file mode 100644
index 0000000000..07696210c5
--- /dev/null
+++ b/ext/reflection/tests/bug77772.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #77772: ReflectionClass::getMethods(null) doesn't work
+--FILE--
+<?php
+
+class Test {
+ public $prop;
+ public function method() {}
+}
+
+$rc = new ReflectionClass(Test::class);
+foreach ($rc->getMethods(null) as $method) {
+ var_dump($method->getName());
+}
+foreach ($rc->getProperties(null) as $prop) {
+ var_dump($prop->getName());
+}
+
+?>
+--EXPECT--
+string(6) "method"
+string(4) "prop"