#34226 [Opn]: global keyword will not work
| From: | nickvd at gmail dot com | Date: | Tue, 23 Aug 2005 22:32:22 +0000 |
| Subject: | #34226 [Opn]: global keyword will not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83922@lists.php.net to get a copy of this message | ||
ID: 34226
User updated by: nickvd at gmail dot com
Reported By: nickvd at gmail dot com
Status: Open
Bug Type: Variables related
Operating System: Linux/Ubuntu 5.04
PHP Version: 5.0.4
New Comment:
I'm at work right now, I won't be able to get more information
(php.ini, ./configure) until tomorrow.
Previous Comments:
------------------------------------------------------------------------
[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