Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #18756 MDB2::singleton does not return an error if the connection is lost
Submitted: 2011-08-25 01:33 UTC
From: iamnos Assigned:
Status: Open Package: MDB2 (version 2.4.1)
PHP Version: 5.2.10 OS: Linux (2.6.18-238.12.1.el5)
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 44 + 24 = ?

 
 [2011-08-25 01:33 UTC] iamnos (Andrew Kerr)
Description: ------------ If a script loses connection after the initial MDB2::Connect call, a call to MDB2::singleton does not produce an error. Test script: --------------- <?php require_once('config.php'); require_once('MDB2.php'); $dsn = array( 'phptype' => 'mysql', 'username' => BASH_USER, 'password' => BASH_PASS, 'hostspec' => BASH_HOST, 'database' => BASH_NAME, ); $mdb2 =& MDB2::factory($dsn); if (PEAR::isError($mdb2)) { echo "Connection failed\n"; exit(); } echo "Connected\n"; sleep(20); // Stop mysqld $mdb2 =& MDB2::singleton($dsn); if (MDB2::isError($mdb2)) { echo "Failed db connection\n"; exit(); } echo "Still Connected\n"; Expected result: ---------------- php -q test.php Connected Failed db connection Actual result: -------------- php -q test.php Connected Still Connected

Comments

 [2011-08-25 02:02 UTC] guppy (Jeff Fisher)
I'm pretty sure singleton is doing what the documentation is suggesting it does. I think what's missing is a ping function to actually test the connection.