Skip to content

Commit 4927938

Browse files
lazergndossche
authored andcommitted
Fix GH-25266: Misaligned read in ReflectionProperty::isReadable()
Closes GH-25271.
1 parent 3bc8956 commit 4927938

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎NEWS‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ PHP NEWS
5050
. Fixed incorrect handling of non-ASCII pending_input bytes in readline_info(),
5151
which could cause readline() to return false prematurely. (Weilin Du)
5252

53+
- Reflection:
54+
. Fixed bug GH-25266 (Misaligned read in ReflectionProperty::isReadable()).
55+
(Lazizbek Ergashev)
56+
5357
- Streams:
5458
. Fixed bug GH-22063 (Stream filter chain UAF on self-removal during
5559
callback). (Ilia Alshanetsky)

‎ext/reflection/php_reflection.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6744,8 +6744,8 @@ ZEND_METHOD(ReflectionProperty, isReadable)
67446744
RETURN_FALSE;
67456745
}
67466746

6747-
if ((prop->flags & ZEND_ACC_VIRTUAL) && prop->hooks) {
6748-
if (!prop->hooks[ZEND_PROPERTY_HOOK_GET]) {
6747+
if (prop->flags & ZEND_ACC_VIRTUAL) {
6748+
if (prop->hooks && !prop->hooks[ZEND_PROPERTY_HOOK_GET]) {
67496749
RETURN_FALSE;
67506750
}
67516751
} else if (obj && (!prop->hooks || !prop->hooks[ZEND_PROPERTY_HOOK_GET])) {

‎ext/reflection/tests/gh25266.phpt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
GH-25266 (Misaligned zval read in ReflectionProperty::isReadable() on internal virtual property)
3+
--CREDITS--
4+
YuanchengJiang
5+
--EXTENSIONS--
6+
dom
7+
--FILE--
8+
<?php
9+
10+
$rp = new ReflectionProperty(DOMDocument::class, 'nodeName');
11+
var_dump($rp->isReadable(null, new DOMDocument));
12+
13+
?>
14+
--EXPECT--
15+
bool(true)

0 commit comments

Comments
 (0)