Bug #73475 [NEW]: Fatal error: PDO::__construct(): out of memory

From: Date: Mon, 07 Nov 2016 12:12:41 +0000
Subject: Bug #73475 [NEW]: Fatal error: PDO::__construct(): out of memory
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205223@lists.php.net to get a copy of this message
From:             hetao at hetao dot name
Operating system: Ubuntu 14.04 x86_64
PHP version:      5.6.27
Package:          MySQL related
Bug Type:         Bug
Bug description:Fatal error: PDO::__construct(): out of memory

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 bug report at https://bugs.php.net/bug.php?id=73475&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=73475&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=73475&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=73475&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=73475&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=73475&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=73475&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=73475&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=73475&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=73475&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=73475&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=73475&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=73475&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=73475&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73475&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=73475&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=73475&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=73475&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73475&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=73475&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=73475&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#205223) next »