php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #29265 mysqli_options Compression Constant
Submitted: 2004-07-19 20:58 UTC Modified: 2004-07-26 15:15 UTC
From: bommar33 at msu dot edu Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.0 OS: Windows 2k3
Private report: No CVE-ID: None
 [2004-07-19 20:58 UTC] bommar33 at msu dot edu
Description:
------------
The mysqli_real_connect page and the mysqli_options pages differ on the valid option constants that may be passed to mysqli_options.  mysqli_real_connect appears to have been updated, while mysqli_options is outdated.

On the mysqli_options page, the constant for using the compressed protocol is listed as 'MYSQLI_OPT_COMPRESS.'  This, however, results in incorrect behavior.  The mysqli_real_connect page lists the constant as 'MYSQLI_CLIENT_COMPRESS,' which does produce the correct behavior.

Reproduce code:
---------------
//As suggested by mysqli_options documentation
$MyConn = mysqli_init();
$MyConn->options( MYSQLI_OPT_COMPRESS, 1 );
if(! $MyConn->real_connect( ... ) )
{
    print( 'Connection failed: ' . mysqli_connect_error() );
}
...
$MyConn->close();

Expected result:
----------------
Expect no output to browser/logs.

Actual result:
--------------
Warning: options() expects parameter 1 to be long, string given in F:\www\hillel\mysql.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-26 15:15 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

If you want to compress the connection, you should use the MYSQLI_OPT_COMPRESS constant in mysqli_real_connect:
mysqli_real_connect($link, $hostname, $username, $password, $dbname, $port, $socket, MYSQLI_CLIENT_COMPRESS);
 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=4ca571b8c96ddccfc62b274f201719f6f9ee09b0
Log: fix #29265: remove MYSQLI_OPT_COMPRESS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Nov 19 09:00:01 2025 UTC