ID:               35831
 Updated by:       [EMAIL PROTECTED]
 Reported By:      francois dot levasseur at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Gentoo Linux (2.6)
 PHP Version:      5.1.1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

To remain backward compatible calling dynamic functions statically
still works.


Previous Comments:
------------------------------------------------------------------------

[2005-12-28 21:02:28] francois dot levasseur at gmail dot com

Description:
------------
I can call a public function like a static function from another class.
The variable "$this" refers to the caller.

Reproduce code:
---------------
<?php

class testA{
        private $var;

        public function __construct(){
                $this->var = 'Hello';
        }

        public function getVar(){
                return $this->var;
        }

        public function test(){
                return $this->getVar();
        }
}

class testB{

        public function test(){
        // Should not work!
                echo testA::test();
        }
}

$myTestB = new testB();
$myTestB->test();
?>


Expected result:
----------------
Error because class testB called a static function that does not
exists.

Actual result:
--------------
Call the static method "getVar()" in class testB. $this refers to
testB.

PHP Fatal error:  Call to undefined method testB::getVar() in
/var/www/svnhome/kronos/kronoscrm/test.php on line 15

Fatal error: Call to undefined method testB::getVar() in
/var/www/svnhome/kronos/kronoscrm/test.php on line 15




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35831&edit=1

Reply via email to