Bug #69228 [Opn->Fbk]: late-static-bindings can not check self-property or static-property
| From: | requinix@php.net | Date: | Thu, 12 Mar 2015 09:49:03 +0000 |
| Subject: | Bug #69228 [Opn->Fbk]: 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-191344@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: requinix@php.net
Reported by: gpgkd906 at gmail dot com
Summary: late-static-bindings can not check self-property or
static-property
-Status: Open
+Status: Feedback
Type: Bug
-Package: PHP Language Specification
+Package: Scripting Engine problem
Operating System: win8
PHP Version: 5.6.6
Block user comment: N
Private report: N
New Comment:
@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?
Previous Comments:
------------------------------------------------------------------------
[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