Bug #67913 [NEW]: mysqlnd ignores MYSQLI_OPT_CONNECT_TIMEOUT option
| From: | ablyler at barracuda dot com | Date: | Tue, 26 Aug 2014 22:55:45 +0000 |
| Subject: | Bug #67913 [NEW]: mysqlnd ignores MYSQLI_OPT_CONNECT_TIMEOUT option | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187287@lists.php.net to get a copy of this message | ||
From: ablyler at barracuda dot com
Operating system: Any
PHP version: 5.5.16
Package: MySQL related
Bug Type: Bug
Bug description:mysqlnd ignores MYSQLI_OPT_CONNECT_TIMEOUT option
Description:
------------
The MYSQLI_OPT_CONNECT_TIMEOUT is ignored when using mysqlnd. To
reproduce this run:
netstat -l -p 9999
Then execute the included test script (wrapped with time).
Thanks to Jason Dictos for coming up with the fix to this.
Test script:
---------------
<?php
$connect_timeout = 5;
$resource = mysqli_init();
if (!mysqli_options($resource, MYSQLI_OPT_CONNECT_TIMEOUT,
$connect_timeout))
{
die('Unable to set connect timeout on resource');
}
var_dump(mysqli_real_connect($resource, '127.0.0.1', 'username',
'password', 'database', 9999));
Expected result:
----------------
It should return in ~5 seconds with errors.
Actual result:
--------------
The script will keep running past the timeout value.
--
Edit bug report at https://bugs.php.net/bug.php?id=67913&edit=1
--