Bug #77496 [NEW]: mysqli->real_connect() overwrites MYSQLI_OPT_LOCAL_INFILE setting
| From: | php at yghe dot net | Date: | Mon, 21 Jan 2019 15:33:05 +0000 |
| Subject: | Bug #77496 [NEW]: mysqli->real_connect() overwrites MYSQLI_OPT_LOCAL_INFILE setting | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219111@lists.php.net to get a copy of this message | ||
From: php at yghe dot net
Operating system: Mac OS X Mojave 10.14.2
PHP version: 7.1.26
Package: MySQLi related
Bug Type: Bug
Bug description:mysqli->real_connect() overwrites MYSQLI_OPT_LOCAL_INFILE setting
Description:
------------
Calls to "mysqli->options(MYSQLI_OPT_LOCAL_INFILE, ...)" before
"mysqli->real_connect()" do not seem to have any effect.
They appear to be silently overwritten when "real_connect()" sets the
option value from the "mysqli.allow_local_infile" configuration option.
Calls after "real_connect()" behave as expected.
For context, see: <https://secure.phabricator.com/T13238>
Test script:
---------------
<?php
$conn = mysqli_init();
// Call (A).
// $conn->options(MYSQLI_OPT_LOCAL_INFILE, 0);
$conn->real_connect('127.0.0.1', 'root', '',
'local_user');
// Call (B).
// $conn->options(MYSQLI_OPT_LOCAL_INFILE, 0);
$conn->query('CREATE TEMPORARY TABLE t (v LONGTEXT NOT NULL)');
$conn->query('LOAD DATA LOCAL INFILE "example.txt" INTO TABLE t');
var_dump(
array(
'errno' => $conn->errno,
'error' => $conn->error,
));
Expected result:
----------------
When "options(MYSQLI_OPT_LOCAL_INFILE, ...)" is called at point (A)
above, it should not be silently ignored.
Possible alternative results might include:
"mysqli.allow_local_infile" is configured in "mysqli_init()" instead of
"real_connect()".
Setting "options(MYSQLI_OPT_LOCAL_INFILE, ...)" before "real_connect()"
fails/warns.
"real_connect()" does not set "MYSQLI_OPT_LOCAL_INFILE" if "options()"
has already set it.
Actual result:
--------------
Any "options(MYSQLI_OPT_LOCAL_INFILE, ...)" call at point (A) is
ignored.
The actual value for the "LOAD DATA LOCAL INFILE" query at the bottom is
determined only by configuration option "mysqli.allow_local_infile"
which is set on the connection inside "real_connect()", and any later
calls to "options(...)".
--
Edit bug report at https://bugs.php.net/bug.php?id=77496&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77496&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77496&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77496&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77496&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77496&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77496&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77496&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77496&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77496&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77496&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77496&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77496&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77496&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77496&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77496&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77496&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77496&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77496&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77496&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77496&r=mysqlcfg