From:             nickvd at gmail dot com
Operating system: Linux/Ubuntu 5.04
PHP version:      5.0.4
PHP Bug Type:     Variables related
Bug description:  global keyword will not work

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 bug report at http://bugs.php.net/?id=34226&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34226&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34226&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34226&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34226&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34226&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34226&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34226&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34226&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34226&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34226&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34226&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34226&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34226&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34226&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34226&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34226&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34226&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34226&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34226&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34226&r=mysqlcfg

Reply via email to