|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73474 Fatal error: PDO::__construct(): out of memory
Submitted: 2016-11-07 12:08 UTC Modified: 2021-07-18 04:22 UTC
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: hetao at hetao dot name Assigned: cmb (profile)
Status: No Feedback Package: PDO related
PHP Version: PHP Version OS: Ubuntu 14.04 x86_64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: hetao at hetao dot name
New email:
PHP Version: OS:


 [2016-11-07 12:08 UTC] hetao at hetao dot name
When the passowrd is string("") and set ATTR_PERSISTENT is true, the PDO __construct where Fatal Error (You keep press the F5 in the browser , U will see the error some times)
If password is not empty or is null , it's ok.

$dsn = 'mysql:dbname=test;host=localhost;port=3306';
$user = 'root'; 
$password = "";//will wrong
//$password = null; //will ok     
try {
    $dbh = new PDO($dsn, $user, $password,
            \PDO::ATTR_PERSISTENT => true
} catch (PDOException $e) {
    echo 'Connection failed: ' . $e->getMessage();

Test script:
/* Connect to an ODBC database using driver invocation */
$dsn = 'mysql:dbname=test;host=localhost;port=3306';
$user = 'root'; 
$password = "";
$dbh = new PDO($dsn, $user, $password,
        \PDO::ATTR_PERSISTENT => true


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-07 14:23 UTC]
-Package: MySQL related +Package: PDO MySQL
 [2016-11-08 16:25 UTC]
-Package: PDO MySQL +Package: PDO Core
 [2016-11-08 16:25 UTC]
Changing package from PDO MySQL to PDO Code, since there are examples for multiple drivers.
 [2016-11-11 08:21 UTC] hetao at hetao dot name
-PHP Version: 5.6.27 +PHP Version: PHP Version
 [2016-11-11 08:21 UTC] hetao at hetao dot name
I compile the lastest php7,php5 src from the, and the bug not exits.
May be the  PHP Version problem?
 [2017-10-24 08:31 UTC]
-Package: PDO Core +Package: PDO related
 [2021-07-09 16:56 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-09 16:56 UTC]
Is this still an issue with any of the actively supported PHP

[1] <>
 [2021-07-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 24 04:01:30 2024 UTC