Skip to content

Commit 796d11c

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed bug #78895 (Reflection detects abstract non-static class as abstract static. IS_IMPLICIT_ABSTRACT is not longer used)
2 parents a776069 + 42a2fb8 commit 796d11c

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

ext/reflection/php_reflection.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4667,7 +4667,7 @@ ZEND_METHOD(reflection_class, getModifiers)
46674667
reflection_object *intern;
46684668
zend_class_entry *ce;
46694669
uint32_t keep_flags = ZEND_ACC_FINAL
4670-
| ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS;
4670+
| ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
46714671

46724672
if (zend_parse_parameters_none() == FAILURE) {
46734673
return;
@@ -6699,6 +6699,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
66996699
zend_class_implements(reflection_class_ptr, 1, reflector_ptr);
67006700
zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
67016701

6702+
/* IS_IMPLICIT_ABSTRACT is not longer used */
67026703
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
67036704
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
67046705
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)