Skip to content

Commit

Permalink
[Fix] Allow private static properties to be found by dynamic lookup
Browse files Browse the repository at this point in the history
Summary:
os_lval and os_get have always excluded private properties, presumably because
they would normally be resolved statically. There are cases however (eg
involving redeclared classes, or $cls::$property) where we cant resolve it
statically, and so we should allow privates to be found.

This fix isnt exactly right, since it could find a public property in a more
derived class, when it should have found a private property with the same name
(it also allows access to a private property that should be hidden). But this
fixes the immediate issue.

Test Plan: fast_tests slow_tests

Reviewers: kma, qigao, myang

Reviewed By: myang

CC: ps, mwilliams, myang

Differential Revision: 342147
  • Loading branch information
mwilliams authored and macvicar committed Oct 18, 2011
1 parent 9f9f4f9 commit 0a7d0c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/base/object_data.cpp
Expand Up @@ -440,7 +440,7 @@ Variant ObjectStaticCallbacks::os_get(CStrRef s) const {
const ClassPropTable *cpt;
const ClassPropTableEntry *prop = PropertyFinder(
&cpt, s, s->hash(),
ClassPropTableEntry::Static|ClassPropTableEntry::Private,
ClassPropTableEntry::Static,
ClassPropTableEntry::Static, this);

if (UNLIKELY(!prop)) {
Expand All @@ -460,7 +460,7 @@ Variant &ObjectStaticCallbacks::os_lval(CStrRef s) const {
const ClassPropTable *cpt;
const ClassPropTableEntry *prop = PropertyFinder(
&cpt, s, s->hash(),
ClassPropTableEntry::Static|ClassPropTableEntry::Private,
ClassPropTableEntry::Static,
ClassPropTableEntry::Static, this);

if (LIKELY(prop != 0) && LIKELY(prop->type == KindOfVariant)) {
Expand Down

0 comments on commit 0a7d0c4

Please sign in to comment.