note 117665 added to mysqli.construct
| From: | webmaster at aryes dot fr | Date: | Sat, 18 Jul 2015 06:58:18 +0000 |
| Subject: | note 117665 added to mysqli.construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203128@lists.php.net to get a copy of this message | ||
A friend of mine encountered a sudden bug with CMS Piwigo. I discovered that :
- He had a hosting rule to use PHP 5.6.
- The hoster uses 5.6.6, verified using phpinfo();.
- The CMS declared a database name parameter as null.
That gallery CMS was unable to connect to MySQL and left only a warning message about it.
We tried to revert back to PHP 5.5, the CMS worked again.
Then we switched back to 5.6.6 and changed those lines :
$dbname = null;
$mysqli = new mysqli($host, $user, $password, $dbname, $port, $socket);
to
$dbname = ''; // Use an empty string, not null
$mysqli = new mysqli($host, $user, $password, $dbname, $port, $socket);
It worked!
So if you made the same mistake, using null where the manual invites to use an empty string, you
should consider correcting your code.
----
Server IP: 72.52.91.14
Probable Submitter: 82.246.145.138
----
Manual Page -- http://php.net/manual/en/mysqli.construct.php
Edit -- https://master.php.net/note/edit/117665
Del: integrated -- https://master.php.net/note/delete/117665/integrated
Del: useless -- https://master.php.net/note/delete/117665/useless
Del: bad code -- https://master.php.net/note/delete/117665/bad+code
Del: spam -- https://master.php.net/note/delete/117665/spam
Del: non-english -- https://master.php.net/note/delete/117665/non-english
Del: in docs -- https://master.php.net/note/delete/117665/in+docs
Del: other reasons-- https://master.php.net/note/delete/117665
Reject -- https://master.php.net/note/reject/117665
Search -- https://master.php.net/manage/user-notes.php