#37419 [Opn]: PDO constructor returns NULL if empty options list is passed under Apache2
| From: | helly@php.net | Date: | Fri, 12 May 2006 21:52:09 +0000 |
| Subject: | #37419 [Opn]: PDO constructor returns NULL if empty options list is passed under Apache2 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97031@lists.php.net to get a copy of this message | ||
ID: 37419
Updated by: helly@php.net
Reported By: suhachov at gmail dot com
Status: Open
Bug Type: Apache2 related
-Operating System: WinXP
+Operating System: *
PHP Version: 5.1.4
-Assigned To:
+Assigned To: ilia
New Comment:
NULL is indeed wrong. If the costructor fails we have two options,
return an invalid object that cannot be used besides getting the error
information or we must throw an error. Ilia managed to allow delay of
base constructor call which allowed to drop final. Maybe he can check
whether we can get the above behavior using the error mode.
Previous Comments:
------------------------------------------------------------------------
[2006-05-12 14:34:28] suhachov at gmail dot com
I've solved this problem - MySQL extension wasn't loaded properly. But
I think this behavior is strange anyway - why don't to say "cannot
connect to MySQL"?
------------------------------------------------------------------------
[2006-05-12 14:20:11] suhachov at gmail dot com
Description:
------------
new PDO('mysql:host=localhost;db=test','test','test',array());
returns NULL under Apache2 and normal object under CLI.
Reproduce code:
---------------
<?
var_dump(
new PDO('mysql:host=localhost;db=test','test','test',array())
);
?>
and run this under Apache2 (my version is 2.0.55)
Expected result:
----------------
to get valid object
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37419&edit=1