|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-07-21 17:37 UTC] arpad@php.net
-Status: Open
+Status: Feedback
[2013-07-21 17:37 UTC] arpad@php.net
[2013-10-15 11:54 UTC] pecl-dev at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ if use method of class A for set session_set_save_handler then invoke a method B1 of the other class B, in the method B1 will can't access constant and static property of the class B, and report error: Fatal error: Access to undeclared static property or Fatal error: Undefined class constant Test script: --------------- <?php class B { const D = 'test'; private $a = 'my test'; static $s = 'my static'; public function p() { var_dump($this); var_dump($this->a); var_dump(self::$s); var_dump(self::D); } } class A { const B = 3; var $s = null; public function __construct() { session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc')); } public function open() { $this->s = new B; } public function start() { session_start(); } public function close() { } public function read() { } public function destroy() { } public function gc() { } public function write() { $this->s->p(); } } $obj = new A; $obj->start(); Expected result: ---------------- report error Actual result: -------------- no error