php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32578 inclusion bug unable to access global object methods
Submitted: 2005-04-05 01:25 UTC Modified: 2006-04-23 07:40 UTC
From: theteofscuba at hotmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5CVS-2005-04-05 (dev) OS: XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: theteofscuba at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-04-05 01:25 UTC] theteofscuba at hotmail dot com
Description:
------------
see title. i've encountered this problem where the latest snapshot build will not execute methods of global objects.

Reproduce code:
---------------
file test1.php:

<?php
global $phpTest;
require_once("test2.php");
$phpTest = new PHPTEST();
?>


file test2.php:

<?php
global $phpTest;

class PHPTEST
{
	public $var;
	function DoSomething()
	{
		echo "hi it worked";
	}
}

require_once("test3.php");

?>

file test3.php:

<?php
global $phpTest;
$phpTest->var = "we can set variables just fine";
$phpTest->DoSomething(); // ka-boom
?>

Expected result:
----------------
.

Actual result:
--------------
Fatal error: Call to undefined method stdClass::DoSomething() in C:\php\test3.php on line 4

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-05 01:27 UTC] theteofscuba at hotmail dot com
this was just a silly mistake. I failed to see that the class object was not defined at the time test3.php executes
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 19:01:32 2024 UTC