#34226 [Opn->Csd]: global keyword will not work
| From: | sniper@php.net | Date: | Wed, 24 Aug 2005 09:35:01 +0000 |
| Subject: | #34226 [Opn->Csd]: global keyword will not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83931@lists.php.net to get a copy of this message | ||
ID: 34226
Updated by: sniper@php.net
Reported By: nickvd at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Variables related
Operating System: Linux/Ubuntu 5.04
PHP Version: 5.0.4
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-08-24 08:20:27] derick@php.net
Works fine here with 5.0.5dev and 6.0.0dev.
------------------------------------------------------------------------
[2005-08-24 00:32:20] nickvd at gmail dot com
I'm at work right now, I won't be able to get more information
(php.ini, ./configure) until tomorrow.
------------------------------------------------------------------------
[2005-08-24 00:31:10] nickvd at gmail dot com
Description:
------------
The keyword 'global' as in global $var; fails to globalize variables,
when used inside a function, the variable remains NULL.
I am using Xampp (php/apache/ftp/etc all in one package), so i did not
compile php myself the url for xampp is:
http://www.apachefriends.org/en/xampp.html
Reproduce code:
---------------
class meh {
function bah(){
echo "whoo?";
}
}
$moo = new meh();
function meee(){
global $moo;
$moo->bah();
}
meee();
Expected result:
----------------
"whoo?"
Actual result:
--------------
"Fatal error: Call to a member function bah() on a non-object in
/var/www/blahblahblah.php on line huh?"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34226&edit=1