Mantis - Quercus
Viewing Issue Advanced Details
1216 minor always 06-26-06 11:24 06-26-06 19:00
nxnlvz  
ferg  
normal  
closed 3.0.19  
fixed  
none    
none 3.0.20  
0001216: reference to GLOBAL variable can not be set using variable variables
When creating refernce to global variable using _ Variable variables _ the parser for oject VarExpr will return false. This causes QuercusParser to fail with "unknown expr to global"

The following will work

  global $link;

This will not
  global $$link;

But you can assign it using

$$link =& $GLOBALS["link"];


Here is the full function. It comes from OSCommerce

function osc_db_connect($server, $username, $password, $link = 'db_link') {
    //global $$link, $db_error;
    //global $db_error1;
    //global $$link;

    $$link =& $GLOBALS["link"];
    $db_error =& $GLOBALS["db_error"];

    $db_error = false;

    if (!$server) {
      $db_error = 'No Server selected.';
      return false;
    }

    $$link = @mysql_connect($server, $username, $password) or $db_error = mysql_error();

    return $$link;
  }


Notes
(0001312)
ferg   
06-26-06 19:00   
php/0237, php/3237