wardjame
asked on
Passed by reference notices in legacy php code
I have inherited some legacy code that is throwing some php notices which I would like to fix. Here is the current notice:
and here is the code in DatabasePeer.php around line 40 (line 40 is line 2 here):
This function is called with the following code:
Any thoughts how I can change this code to prevent the notice?
PHP Notice: Only variable references should be returned by reference in \wwwroot\classes\model\DatabasePeer.php on line 40
and here is the code in DatabasePeer.php around line 40 (line 40 is line 2 here):
public static function &connect($host,$user,$pass) {
return @mssql_connect($host, $user, $pass);
return 1;
}
This function is called with the following code:
$conn = DatabasePeer::connect($CONFIG_DATABASE_HOST, $CONFIG_DATABASE_USERNAME, $CONFIG_DATABASE_PASSWORD);
try{
$sqldb = DatabasePeer::select_db($CONFIG_DATABASE_NAME, $conn);
}catch(Exception $e){
die("Couldn't open database $CONFIG_DATABASE_NAME".$e);
exit();
}
Any thoughts how I can change this code to prevent the notice?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.