Home » Database » MDB2_Driver_mysqli » Bug #8807
Parameter order is wrong in fallback code in setCharset()
Details
| Submitted | 2006-09-28 12:17 UTC |
|---|---|
| From | fredrik at wangel dot net |
| Assigned | lsmith |
| Status | Closed |
| Package | MDB2_Driver_mysqli |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2006-09-28 12:17 UTC] fredrik at wangel dot net
Description:
------------
MDB2_Driver_mysqli::setCharset():
If the mysqli_set_charset() function is missing, the fallback code tries to call mysqli_query() with a query prepared using mysqli_real_escape_string(). However, the order of the parameters to these two functions is incorrect, resulting in PHP warnings.
Test script:
---------------
A patch to fix this bug:
527,528c527,528
< $query = "SET character_set_client = '".mysqli_real_escape_string($charset, $connection)."'";
< $result = @mysqli_query($query, $connection);
---
> $query = "SET character_set_client = '".mysqli_real_escape_string($connection, $charset)."'";
> $result = @mysqli_query($connection, $query);
Expected result:
----------------
No warnings, no errors.
Actual result:
--------------
Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, string given in E:\apache\php\pear\MDB2\Driver\mysqli.php on line 527