Bug #73474 [Opn]: Fatal error: PDO::__construct(): out of memory

From: Date: Tue, 08 Nov 2016 16:25:51 +0000
Subject: Bug #73474 [Opn]: Fatal error: PDO::__construct(): out of memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205241@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73474&edit=1

 ID:                 73474
 Updated by:         adambaratz@php.net
 Reported by:        hetao at hetao dot name
 Summary:            Fatal error: PDO::__construct(): out of memory
 Status:             Open
 Type:               Bug
-Package:            PDO MySQL
+Package:            PDO Core
 Operating System:   Ubuntu 14.04 x86_64
 PHP Version:        5.6.27
 Block user comment: N
 Private report:     N

 New Comment:

Changing package from PDO MySQL to PDO Code, since there are examples for multiple drivers.


Previous Comments:
------------------------------------------------------------------------
[2016-11-07 14:17:50] cmb@php.net

Related To: Bug #73475

------------------------------------------------------------------------
[2016-11-07 12:08:21] 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);



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73474&edit=1


Thread (5 messages)

« previous php.bugs (#205241) next »