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

From: Date: Fri, 09 Jul 2021 16:56:53 +0000
Subject: Bug #73474 [Opn->Fbk]: Fatal error: PDO::__construct(): out of memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234941@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:         cmb@php.net
 Reported by:        hetao at hetao dot name
 Summary:            Fatal error: PDO::__construct(): out of memory
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            PDO related
 Operating System:   Ubuntu 14.04 x86_64
 PHP Version:        PHP Version 5.6.27-1+deb.sury.org~xenial+1
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Is this still an issue with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>


Previous Comments:
------------------------------------------------------------------------
[2016-11-11 08:21:55] hetao at hetao dot name

I compile the lastest php7,php5 src from the php.net, and the bug not exits.
May be the  PHP Version 5.6.27-1+deb.sury.org~xenial+1 problem?

------------------------------------------------------------------------
[2016-11-08 16:25:50] adambaratz@php.net

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

------------------------------------------------------------------------
[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 (#234941) next »