Skip to content

Commit 42a2fb8

Browse files
committed
Fixed bug #78895 (Reflection detects abstract non-static class as abstract static. IS_IMPLICIT_ABSTRACT is not longer used)
1 parent b37a5b9 commit 42a2fb8

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ PHP NEWS
3737
- PCRE:
3838
. Fixed bug #78853 (preg_match() may return integer > 1). (cmb)
3939

40+
- Reflection:
41+
. Fixed bug #78895 (Reflection detects abstract non-static class as abstract
42+
static. IS_IMPLICIT_ABSTRACT is not longer used). (Dmitry)
43+
4044
- Standard:
4145
. Fixed bug #77638 (var_export'ing certain class instances segfaults). (cmb)
4246
. Fixed bug #78840 (imploding $GLOBALS crashes). (cmb)

ext/reflection/php_reflection.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4574,7 +4574,7 @@ ZEND_METHOD(reflection_class, getModifiers)
45744574
reflection_object *intern;
45754575
zend_class_entry *ce;
45764576
uint32_t keep_flags = ZEND_ACC_FINAL
4577-
| ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
4577+
| ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
45784578

45794579
if (zend_parse_parameters_none() == FAILURE) {
45804580
return;
@@ -6835,6 +6835,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
68356835
zend_class_implements(reflection_class_ptr, 1, reflector_ptr);
68366836
zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
68376837

6838+
/* IS_IMPLICIT_ABSTRACT is not longer used */
68386839
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
68396840
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
68406841
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL);

ext/reflection/tests/bug78895.phpt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
Fixed bug #78895 (Reflection detects abstract non-static class as abstract static).
3+
--FILE--
4+
<?php
5+
abstract class Foo {
6+
abstract public function f1();
7+
}
8+
interface I {
9+
public function f2();
10+
}
11+
trait T {
12+
abstract public function f2();
13+
}
14+
class Bar extends Foo implements I {
15+
use T;
16+
function f1() {}
17+
function f2() {}
18+
}
19+
$ref = new ReflectionClass(Foo::class);
20+
var_dump(Reflection::getModifierNames($ref->getModifiers()));
21+
$ref = new ReflectionClass(I::class);
22+
var_dump(Reflection::getModifierNames($ref->getModifiers()));
23+
$ref = new ReflectionClass(T::class);
24+
var_dump(Reflection::getModifierNames($ref->getModifiers()));
25+
$ref = new ReflectionClass(Bar::class);
26+
var_dump(Reflection::getModifierNames($ref->getModifiers()));
27+
?>
28+
--EXPECT--
29+
array(1) {
30+
[0]=>
31+
string(8) "abstract"
32+
}
33+
array(0) {
34+
}
35+
array(0) {
36+
}
37+
array(0) {
38+
}

0 commit comments

Comments
 (0)