call_user_func possible bug in PHP5Rc1 PHP5RC2, am I crazy?

From: Date: Tue, 27 Apr 2004 17:59:07 +0000
Subject: call_user_func possible bug in PHP5Rc1 PHP5RC2, am I crazy?
Groups: php.general 
Request: Send a blank email to php-general+get-184793@lists.php.net to get a copy of this message
Hey there Guys, I've been seeing some behavior in PHP5 that doesn't seem to jive with past (PHP4) behavior of call_user_func. Basically, it feels like methods of a class are being called, but not in an instance of the class. 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');
    print ("I have a return of isCreated [" . call_user_func($function) . "]"  );
?> My Results: vfabello@godot:~/workspace/loki/root$ php5rc1 test3.php Fatal error: Using $this when not in object context in /home/vfabello/workspace/loki/root/test3.php on line 16 vfabello@godot:~/workspace/loki/root$ php5rc2 test3.php Fatal error: Using $this when not in object context in /home/vfabello/workspace/loki/root/test3.php on line 16 (php5rc1 and php5rc2 are ln -s to their appropriate binaries, configure parameters were: './configure' '--with-zlib' '--enable-wddx' '--enable-bcmath' '--with-openssl' '--with-bz2' '--enable-memory-limit' '--prefix=/usr/share/php5rc2' '--with-config-file-path=/etc/php5rc2/apache' '--with-exec-dir=/usr/lib/php5rc2/libexec' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysql' '--with-apxs=/usr/bin/apxs' '--with-mysql=/usr/share/mysql' '--with-libxml-dir=/usr/lib' '--enable-soap' '-with-config-file-path=/usr/share/php5rc2' ) Thanks Vincent hrvinnie NOSPAM @ yahoo DOT NOSPAM com

« previous php.general (#184793) next »