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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: suhachov at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Dec 26 11:01:30 2024 UTC