#45743 [NoF->Opn]: property_exists fails to find static protected member in child class

[email protected] ("ilewis at uk dot ibm dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45743
 User updated by:  ilewis at uk dot ibm dot com
 Reported By:      ilewis at uk dot ibm dot com
-Status:           No Feedback
+Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Fedora 8
 PHP Version:      5.3CVS-2008-08-07 (snap)
 New Comment:

re-opening as I've submitted an updated patch


Previous Comments:
------------------------------------------------------------------------

[2008-08-15 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2008-08-07 12:36:22] ilewis at uk dot ibm dot com

I've put an updated diff -u output on pastebin:

http://pastebin.com/m43078aa5

I've also realised that this fix breaks testcase
Zend/tests/bug42211.phpt, but I think this is a bug in the testcase,
that is, it is testing for the broken behaviour.

I've put a patch for the testcase on pasetbin as well

http://pastebin.com/m15c01dec

------------------------------------------------------------------------

[2008-08-07 10:18:16] [email protected]

Send patches in unified diff format. (diff -u)

------------------------------------------------------------------------

[2008-08-07 09:57:20] ilewis at uk dot ibm dot com

Description:
------------
property_exists() doesn't find a member in a child class when the
member is static and protected.

The code below shows that the member is accessible and should be found
by property_exists.

I've created a patch which I think fixes this, and put it here:

http://pastebin.com/m272f815c

The patch was built against a CVS snap from today:
php5.3-200808070630



Reproduce code:
---------------
<?php
class aParent {
  public static function staticTest() {
    var_dump(property_exists("A", "prot"));
    var_dump(A::$prot);  
  }
}

class A extends aParent { protected static $prot = "prot"; }

echo "\nparent scope:\n";
aParent::staticTest();
?>

Expected result:
----------------
parent scope:
bool(true)
string(4) "prot"

Actual result:
--------------
parent scope:
bool(false)
string(4) "prot"


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45743&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.