summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-12-09 13:49:12 +0300
committerDmitry Stogov <dmitry@zend.com>2019-12-09 13:49:12 +0300
commit42a2fb8411848236d0cd56b5efd05e352e62ee3d (patch)
tree2b408e1e7013ec9341b6602bc654d2d3a06def78
parentb37a5b9ca4deedaab94d31ba932b6a29c39db39c (diff)
downloadphp-git-42a2fb8411848236d0cd56b5efd05e352e62ee3d.tar.gz
Fixed bug #78895 (Reflection detects abstract non-static class as abstract static. IS_IMPLICIT_ABSTRACT is not longer used)
-rw-r--r--NEWS4
-rw-r--r--ext/reflection/php_reflection.c3
-rw-r--r--ext/reflection/tests/bug78895.phpt38
3 files changed, 44 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 787a546135..afa5823d32 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,10 @@ PHP NEWS
- PCRE:
. Fixed bug #78853 (preg_match() may return integer > 1). (cmb)
+- Reflection:
+ . Fixed bug #78895 (Reflection detects abstract non-static class as abstract
+ static. IS_IMPLICIT_ABSTRACT is not longer used). (Dmitry)
+
- Standard:
. Fixed bug #77638 (var_export'ing certain class instances segfaults). (cmb)
. Fixed bug #78840 (imploding $GLOBALS crashes). (cmb)
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index d669ff6da2..386130a307 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4574,7 +4574,7 @@ ZEND_METHOD(reflection_class, getModifiers)
reflection_object *intern;
zend_class_entry *ce;
uint32_t keep_flags = ZEND_ACC_FINAL
- | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
+ | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -6835,6 +6835,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
zend_class_implements(reflection_class_ptr, 1, reflector_ptr);
zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
+ /* IS_IMPLICIT_ABSTRACT is not longer used */
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL);
diff --git a/ext/reflection/tests/bug78895.phpt b/ext/reflection/tests/bug78895.phpt
new file mode 100644
index 0000000000..7e616c4456
--- /dev/null
+++ b/ext/reflection/tests/bug78895.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Fixed bug #78895 (Reflection detects abstract non-static class as abstract static).
+--FILE--
+<?php
+abstract class Foo {
+ abstract public function f1();
+}
+interface I {
+ public function f2();
+}
+trait T {
+ abstract public function f2();
+}
+class Bar extends Foo implements I {
+ use T;
+ function f1() {}
+ function f2() {}
+}
+$ref = new ReflectionClass(Foo::class);
+var_dump(Reflection::getModifierNames($ref->getModifiers()));
+$ref = new ReflectionClass(I::class);
+var_dump(Reflection::getModifierNames($ref->getModifiers()));
+$ref = new ReflectionClass(T::class);
+var_dump(Reflection::getModifierNames($ref->getModifiers()));
+$ref = new ReflectionClass(Bar::class);
+var_dump(Reflection::getModifierNames($ref->getModifiers()));
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ string(8) "abstract"
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+} \ No newline at end of file