Bug #69228 [Com]: late-static-bindings can not check self-property or static-property

From: Date: Thu, 12 Mar 2015 08:51:07 +0000
Subject: Bug #69228 [Com]: late-static-bindings can not check self-property or static-property
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-736@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 Comment by: inefedor at gmail dot com Reported by: gpgkd906 at gmail dot com Summary: late-static-bindings can not check self-property or static-property Status: Open Type: Bug Package: PHP Language Specification Operating System: win8 PHP Version: 5.6.6 Block user comment: N Private report: N New Comment: 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). Previous Comments: ------------------------------------------------------------------------ [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

« previous php.standards (#736) next »