PHP :: Bug #76703 :: MYSQLI_OPT_READ_TIMEOUT cannot be changed after connection established
php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76703 MYSQLI_OPT_READ_TIMEOUT cannot be changed after connection established
Submitted: 2018-08-03 23:02 UTC Modified: -
From: php at darkain dot com Assigned:
Status: Open Package: MySQLi related
PHP Version: 7.2.8 OS: Debian 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at darkain dot com
New email:
PHP Version: OS:

 

 [2018-08-03 23:02 UTC] php at darkain dot com
Description:
------------
The MYSQLI_OPT_READ_TIMEOUT option cannot be changed after a connection is established. This means if it is set to a low value to ensure a stable initial connection to the MySQL server, it cannot be raised back up again before executing long running queries.

Test script:
---------------
<?php
$connection = mysqli_init();

//ensure we receive a reply from mysql in under 1 second
$connection->options(MYSQLI_OPT_READ_TIMEOUT, 1);

//connect to the mysql server
$connection->real_connect($server, $username, $password, $database);

//change timeout to 1 hour so we can run a long query
$connection->options(MYSQLI_OPT_READ_TIMEOUT, 60*60);

//attempt to pull results from a very large table, something that would exceed the initial 1 second timeout value, but not the 1 hour timeout value
$connection->query('SELECT * FROM `huge_table`');


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-07 07:44 UTC] liyang1025 at gmail dot com
I'm searching the PHP-src source code and find some clue, the MYSQLI_OPT_READ_TIMEOUT option will be only assigned to the php_stream is at the establish connection and then reassign the option value but the php_stream's option is not will be reassigned.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sat Aug 18 12:01:26 2018 UTC