Bug #69228 [Fbk->NoF]: late-static-bindings can not check self-property or static-property
| From: | php-bugs at lists dot php dot net | Date: | Sun, 22 Mar 2015 04:22:19 +0000 |
| Subject: | Bug #69228 [Fbk->NoF]: late-static-bindings can not check self-property or static-property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191518@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69228&edit=1
ID: 69228
Updated by: php-bugs@lists.php.net
Reported by: gpgkd906 at gmail dot com
Summary: late-static-bindings can not check self-property or
static-property
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: win8
PHP Version: 5.6.6
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2015-03-12 09:49:03] requinix@php.net
@gpgkd906, I feel like you're trying to report a different bug than the one @inefedor just
correctly explained away. Maybe your repro script isn't completely accurate?
------------------------------------------------------------------------
[2015-03-12 08:51:06] inefedor at gmail dot com
This is expected behavior, $set wasn't changed at the moment of calling app2::add() hence you
get bool(true) because both app::$set and app2::$set are empty arrays (note that array comparison
semantics with
=== are not the same as for objects).
------------------------------------------------------------------------
[2015-03-12 07:51:38] gpgkd906 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/language.oop5.late-static-bindings
---
late-static-bindings is usually worked wonderful for me, bug when I try to find a property is
defined by parent-class or child-class, I find it could not check the property is defined by
self-class or static-class;
Test script:
---------------
<?php
class app {
static protected $set = [];
static public function add($key)
{
var_dump(static::$set === self::$set);
static::$set[] = $key;
var_dump(self::$set);
}
static public function get()
{
return static::$set;
}
}
class app2 extends app {
static protected $set = [];
}
class app3 extends app {
static protected $set = [];
}
app2::add("app2");
var_dump(app3::get());
Expected result:
----------------
bool(false)
array(0) {
}
array(0) {
}
Actual result:
--------------
bool(true)
array(0) {
}
array(0) {
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69228&edit=1