|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49027 mysqli_options() doesn't work when using mysqlnd
Submitted: 2009-07-23 09:07 UTC Modified: 2009-08-27 13:17 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: andreas dot streichardt at globalpark dot com Assigned: mysql
Status: Closed Package: MySQLi related
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID:
 [2009-07-23 09:07 UTC] andreas dot streichardt at globalpark dot com
mysqli_real_connect() doesn't honor init commands previously set with mysqli_options($x,MYSQLI_INIT_COMMAND) when using the mysqlnd driver.

I am not sure if this is simply a missing feature or a bug. At least this is a documentation problem as it isn't noted anywhere.

Ideally if this is not a bug mysqli_options should return false so one notices that it isn't supported yet.

This problem only appears when using mysqlnd as the driver.

mysql> SELECT version();
| version()      |
| 5.4.1-beta-log |

But i don't think this is related to the database version, is it?

Reproduce code:
if (!mysqli_options($handle,MYSQLI_INIT_COMMAND,"testtest"))
  print "Broken!\n";

if (!@mysqli_real_connect($handle,"localhost","root","","test",3306))
  print "Connection broken!\n";

Expected result:
Connection broken! (testtest is not a valid query)

If the general log is activated you should see the query in the log

Actual result:
blank output (database connection was successful - assuming that the credentials provided in the connection string work).

no "testtest" query in the general log


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-06 00:38 UTC]
The INIT_COMMAND is currently not supported by mysqlnd, along with a bunch of other options, see ext/mysqlnd/mysqlnd.c. Leaving this with the mysql guys
 [2009-08-27 13:16 UTC]
Automatic comment from SVN on behalf of andrey
Log: Fixed bug #49027 (mysqli_options() doesn't work when using mysqlnd)
 [2009-08-27 13:17 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Fix will appear in 5.3.1
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 06:01:48 2015 UTC