ID: 22241 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Linux web13.90.ha.ovh.net 2.4.20 PHP Version: 4.3.0 New Comment:
After fixing that typo in the testCallsInFunction(), it works just fine. hint: $toutou->test() -> $toutou2->test() Previous Comments: ------------------------------------------------------------------------ [2003-02-16 11:06:00] [EMAIL PROTECTED] I do not have root access on the server as this is a shared server. Perhaps someone else can try ------------------------------------------------------------------------ [2003-02-16 10:29:38] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-02-16 06:17:10] [EMAIL PROTECTED] PHPInfo for the server is here : http://90plan.ovh.net/phpinfo.php The code is here : <pre> <?php class Toto { var $port; function Toto($string) { $this->port=$string; echo "<br><br>TOTO constructor was called so class was found!! Dumping vars:<br><i>"; var_dump($this); echo"</i><br>"; } function test() { echo "<br><br><b>method <i>test</i> called.</b> Value for port is :".$this->port; } } $toutou=new Toto("PORT1"); $toutou->test(); echo "<hr>Entering function and doing the same calls with value PORT2"; testCallsInFunction(); function testCallsInFunction() { $toutou2=new Toto("PORT2"); $toutou->test(); } ?></pre> The output I get is <pre> TOTO constructor was called so class was found!! Dumping vars: object(toto)(1) { ["port"]=> string(5) "PORT1" } method test called. Value for port is :PORT1 -------------------------------------------------------------------------------- Entering function and doing the same calls with value PORT2 TOTO constructor was called so class was found!! Dumping vars: object(toto)(1) { ["port"]=> string(5) "PORT2" } Fatal error: Call to a member function on a non-object in /home/eurobill/www/toto.php on line 29 </pre> I have tried including the class in another file and adding an include statement inside the function but it still doesn't work. This bug forced me to remove calls to objects in functions for my site ! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22241&edit=1