Robin Fernandes
2008-02-26 17:36:30 UTC
Hi Marcus,
History: http://thread.gmane.org/gmane.comp.php.devel/47956/focus=47956
To summarize, we agree that there is an inconsistency related to
static property inheritance, because:
--> In the following case, A::$p and B::$p share the same value:
class A { protected static $p; } class B extends A { public static $p; }
--> Yet in the following cases, A::$p and B::$p have two separate values:
class A { protected static $p; } class B extends A { protected static $p; }
class A { public static $p; } class B extends A { public static $p; }
You originally suggested fixing the inconsistency by changing the last
2 cases, so that A::$p and B::$p always share the same value. However,
that approach raised some concerns described by myself and Jochem, for
example:
--> Inconsistency with overridden methods
--> Inconsistency with shadowed class constants.
Consequently, I'd like to propose resolving this by changing the first
case, so that A::$p and B::$p always have separate values.
Here's a patch that implements this. It includes relevant changes to
existing tests, plus some supplementary tests to address Jochem's
concern about the impact on LSB.
Patch against snap php6.0-200802251530: http://pastebin.ca/919094
Disclaimer: I am not an internals expert - patch might overlook some
cases, feedback welcome. :)
Let me know what you think.
Regards,
Robin
I checked it out in more detail and it is indeed broken as in it is not
consistent
If possible, I'd like to revive this discussion. Patch included. :)consistent
History: http://thread.gmane.org/gmane.comp.php.devel/47956/focus=47956
To summarize, we agree that there is an inconsistency related to
static property inheritance, because:
--> In the following case, A::$p and B::$p share the same value:
class A { protected static $p; } class B extends A { public static $p; }
--> Yet in the following cases, A::$p and B::$p have two separate values:
class A { protected static $p; } class B extends A { protected static $p; }
class A { public static $p; } class B extends A { public static $p; }
You originally suggested fixing the inconsistency by changing the last
2 cases, so that A::$p and B::$p always share the same value. However,
that approach raised some concerns described by myself and Jochem, for
example:
--> Inconsistency with overridden methods
--> Inconsistency with shadowed class constants.
Consequently, I'd like to propose resolving this by changing the first
case, so that A::$p and B::$p always have separate values.
Here's a patch that implements this. It includes relevant changes to
existing tests, plus some supplementary tests to address Jochem's
concern about the impact on LSB.
Patch against snap php6.0-200802251530: http://pastebin.ca/919094
Disclaimer: I am not an internals expert - patch might overlook some
cases, feedback welcome. :)
Let me know what you think.
Regards,
Robin
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php