Bug #73475 [Opn->Dup]: Fatal error: PDO::__construct(): out of memory
Edit report at https://bugs.php.net/bug.php?id=73475&edit=1
ID: 73475
Updated by: cmb@php.net
Reported by: hetao at hetao dot name
Summary: Fatal error: PDO::__construct(): out of memory
-Status: Open
+Status: Duplicate
Type: Bug
Package: MySQL related
Operating System: Ubuntu 14.04 x86_64
PHP Version: 5.6.27
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #73474.
Previous Comments:
------------------------------------------------------------------------
[2016-11-07 12:12:41] 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=73475&edit=1
Thread (2 messages)