PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » MDB2_Driver_mysqli » Bug #9077

method setCharset'bug

Details

Submitted2006-10-18 05:49 UTC
Fromalpha1130 at gmail dot com
StatusDuplicate
PackageMDB2_Driver_mysqli
PHP Version5.1.4
OSwinxp
Roadmaps(Not assigned)

Comments

[2006-10-18 05:49 UTC] alpha1130 at gmail dot com

Description:
------------
a bug in method "setCharset"

params in function "mysqli_real_escape_string" have been placed into wrong position, it make's method "setCharset" can not run...

I try to exchange these params positoin, it can be run by call setCharset, but can not be run in dsn mode, just like the example code below.

==
sorry my poor english

Test script:
---------------
// throw an error
include_once("MDB2.php");

$dsn = "mysqli://web:123@192.168.0.115/mdb2_usage?charset=utf8";

$DB = MDB2::connect($dsn);

if (PEAR::isError($DB)) {
die($DB->getMessage());
}

Expected result:
----------------
Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, string given in E:\PHP\PEAR-1.4.11\PEAR-1.4.11\MDB2\Driver\mysqli.php on line 527
MDB2 Error: Array

[2006-10-18 06:56 UTC] alpha1130 at gmail dot com

"mysqli_query" and "mysqli_query" with wrong params position

change them like this should be work fine:

mysqli_real_escape_string($connection, $charset)

mysqli_query($connection, $query)