From:             humillo at hotmail dot com
Operating system: linux 2.4.20
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Variables related
Bug description:  global $$var doesnt work as expected

Description:
------------
The global variable isnt being assigned the mysql connection resource id.
This worked fine with PHP3 and 4.

Notes:
* Ive noticed that using anything like:
    $$varname = "GOODBYE";
... assigns correctly, only with mysql_connect() the assignment is
ignored.

* If you remove the global declaration and use:
    $GLOBALS[$varname] = mysql_connect();
.. it works.


Reproduce code:
---------------
<?php
  function checkme($varname = 'var') {
    global $$varname;

    $$varname = mysql_connect("your", "data", "here");
  }

  $var = 'HELLO';
  checkme();
  echo $var; // Should be a resource_id, but its "HELLO" 
?>


Expected result:
----------------
Resource Id #<something>


Actual result:
--------------
HELLO

-- 
Edit bug report at http://bugs.php.net/?id=24421&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24421&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24421&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24421&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24421&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24421&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24421&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24421&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24421&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24421&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24421&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24421&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24421&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24421&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24421&r=gnused

Reply via email to