From: djmaze at cpgnuke dot com
Operating system: Win2k
PHP version: 5.1.0
PHP Bug Type: Scripting Engine problem
Bug description: Calling class instance inside other class produces memory
issues
Description:
------------
I'm building a huge PHP5 script that is using classes.
However somehow by returning function data to a previous call thru another
class the data is not returned but a NULL instead.
The below script has a similar layout as mine but as i said mine is huge,
so if thisone works as expected i will figure out a way to provide my huge
reproducable bug.
Reproduce code:
---------------
<?php
class A
{
public function foo()
{
$foo = 'foo';
return $foo;
}
}
class B
{
public function bar()
{
global $A;
$bar = $A->foo();
return $bar;
}
}
class C
{
public function test()
{
global $B;
$test = $B->bar();
echo gettype($test);
}
}
$A = new A();
$B = new B();
C::test();
Expected result:
----------------
string
Actual result:
--------------
NULL
--
Edit bug report at http://bugs.php.net/?id=35376&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35376&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=35376&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=35376&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35376&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35376&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35376&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35376&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35376&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35376&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35376&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35376&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35376&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35376&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35376&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35376&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35376&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35376&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35376&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35376&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35376&r=mysqlcfg