From: basilio dot vera at softonic dot com
Operating system: Linux RHEL4
PHP version: 5.2.5
PHP Bug Type: MySQLi related
Bug description: Can't define the connect timeout on mysqli extension class
Description:
------------
I can't change the "MYSQLI_OPT_CONNECT_TIMEOUT" flag inside an extended
class of mysqli.
This is not really a bug, but a missed feature!
Reproduce code:
---------------
// I want some similar to this:
$mysqli = mysqli_init();
$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
$mysqli->real_connect('localhost', 'my_user', 'my_password', 'world');
// My class that does many magic things.
class mysqli2 extends mysqli
{
public function __construct( $host, $user, $pass, $db )
{
parent::__construct( $host, $user, $pass, $db );
// Too late, the connection has been done before!
$this->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
}
}
// If I put the options call before the parent::__construct() call I get
'Couldn't fetch DbLink' error.
// And, obviously, this does not work.
class mysqli3 extends mysqli_init {}
Expected result:
----------------
The connect timeout has been changed to 5 seconds.
Actual result:
--------------
The connect timeout has not been changed.
--
Edit bug report at http://bugs.php.net/?id=43866&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43866&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43866&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43866&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43866&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43866&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43866&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43866&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43866&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43866&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43866&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43866&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43866&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43866&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43866&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43866&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43866&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43866&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43866&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43866&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43866&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43866&r=mysqlcfg