php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73475 Fatal error: PDO::__construct(): out of memory
Submitted: 2016-11-07 12:12 UTC Modified: 2016-11-07 14:17 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: hetao at hetao dot name Assigned:
Status: Duplicate Package: MySQL related
PHP Version: 5.6.27 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hetao at hetao dot name
New email:
PHP Version: OS:

 

 [2016-11-07 12:12 UTC] hetao at hetao dot name
Description:
------------
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,
        array( 
            \PDO::ATTR_PERSISTENT => true
        )   
    );  
} catch (PDOException $e) {
    echo 'Connection failed: ' . $e->getMessage();
}   

Test script:
---------------
<?php           
/* 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,
    array(
        \PDO::ATTR_PERSISTENT => true
    )   
);  
print_r($dbh);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-07 14:17 UTC] cmb@php.net
-Status: Open +Status: Duplicate
 [2016-11-07 14:17 UTC] cmb@php.net
Duplicate of bug #73474.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC