Re: call_user_func possible bug in PHP5Rc1 PHP5RC2, am I crazy?

From: Date: Tue, 27 Apr 2004 23:53:54 +0000
Subject: Re: call_user_func possible bug in PHP5Rc1 PHP5RC2, am I crazy?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184816@lists.php.net to get a copy of this message
* Thus wrote Vincent A. Wixer (hrvinnie@yahoo.com): >... > > I'm afraid no one else on my team is testing php5 so I can't check with > them to see if I'm doing something wrong. I'd really appreciate if > anyone else test driving PHP5 RC1 or RC2 could tell me if they're > getting the same "not in object context" message. > > I'd certianly hate to submit an bad bug. > > My Code: > > <?php > > // ------------------------------------------------------- > > class test_call_user_func > { > var $created = false; > > function __construct() > { > $this->created = true; > } > > function isCreated() > { > $ret = $this->created; > return $ret; > } > > } > > > $my_args = array ('first' => 1, 'second' => 2, 'third' > => 3); > > > $function = array('test_call_user_func', 'isCreated'); This will call: this_call_user_func::isCreated(); And only static variables can be accessed within a static function. <?php class foo { static $created = false; function __construct() { self::$created = true; } public static function isCreated() { return self::$created; } } $func = array('foo', 'isCreated'); // will echo false echo call_user_func($func); $foo = new foo(); // will echo true echo call_user_func($func); Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#184816) next »