php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35376 Calling class instance inside other class produces memory issues
Submitted: 2005-11-25 02:05 UTC Modified: 2005-11-25 02:26 UTC
From: djmaze at cpgnuke dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.0 OS: Win2k
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: djmaze at cpgnuke dot com
New email:
PHP Version: OS:

 

 [2005-11-25 02:05 UTC] djmaze at cpgnuke dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-25 02:26 UTC] iliaa@php.net
Works fine in PHP 5.1.0
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 16:01:34 2025 UTC