1

My server setup is

PHP 5.5.8
PostgreSQL 9.3
adodb 5

Here are the coorrisponding lines to error

45 include($GLOBALS["webpath"] . "/adodb5/adodb.inc.php");
46 $conn = &ADONewConnection('postgres');
47 $conn->PConnect('host=www.site.com port=5432 dbname=database user=username password=secret');

Have Also tried

$conn = &ADONewConnection('postgres9');

but i receve this error message everytime i try to run this page

Strict Standards: Only variables should be assigned by reference in /home/site/public_html/cron.php on line 46
Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
Big Al Ruby Newbie
  • 69
  • 1
  • 2
  • 14
  • This was two questions in one. I've removed the second unrelated one; please post a new question for that. You can see your text in the edit history. Also fixed your tags. – Craig Ringer Apr 16 '14 at 23:55
  • possible duplicate of [Strict Standards: Only variables should be assigned by reference PHP 5.4](http://stackoverflow.com/questions/11777908/strict-standards-only-variables-should-be-assigned-by-reference-php-5-4) – Craig Ringer Apr 16 '14 at 23:56

1 Answers1

1

Strict Standards: Only variables should be assigned by reference in ADONewConnection

$conn = &ADONewConnection('postgres9');

You need to remove the & prefix.

The & prefix attempts to assign a reference to the return value of the function, to $conn. So that $conn refers to the very same object and not a copy of that object. This was necessary in PHP4, however, a change in the way class instances are stored in PHP5 makes this unnecessary.

Just to slightly confuse matters, this would actually be valid in PHP5 if the function returned a reference. But it doesn't in this instance, hence the strict notice. Normally, "only variables can be assigned by reference".

MrWhite
  • 43,179
  • 8
  • 60
  • 84