php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37419 PDO constructor returns NULL if empty options list is passed under Apache2
Submitted: 2006-05-12 14:20 UTC Modified: 2006-05-14 15:36 UTC
From: suhachov at gmail dot com Assigned: ilia (profile)
Status: Not a bug Package: Apache2 related
PHP Version: 5.1.4 OS: *
Private report: No CVE-ID: None
 [2006-05-12 14:20 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-12 14:34 UTC] 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 21:52 UTC] helly@php.net
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.
 [2006-05-14 15:36 UTC] iliaa@php.net
Actual result is not NULL, when instantiation of the PDO class 
happens an exception is thrown.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 03:01:29 2024 UTC