Skip to content

Commit 5fe7d81

Browse files
author
cpriest
committed
Property visibility was not being over-ridden when accessors were
involved. fixes php#34
1 parent 9052982 commit 5fe7d81

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
ZE2 Visibility of property is ignored when involving an accessor (accessor visibility checked)
3+
--FILE--
4+
<?php
5+
6+
class Foo {
7+
protected $bar {
8+
public get { return 'test'; }
9+
}
10+
}
11+
12+
$foo = new Foo;
13+
var_dump($foo->bar);
14+
15+
?>
16+
===DONE===
17+
--EXPECTF--
18+
string(%d) "test"
19+
===DONE===

Zend/zend_object_handlers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ zend_always_inline struct _zend_property_info *zend_get_property_info_quick(zend
444444
}
445445
return scope_property_info;
446446
} else if (property_info) {
447-
if (UNEXPECTED(denied_access != 0)) {
447+
if (!property_info->ai && UNEXPECTED(denied_access != 0)) {
448448
/* Information was available, but we were denied access. Error out. */
449449
if (!silent) {
450450
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, Z_STRVAL_P(member));

0 commit comments

Comments
 (0)