Bug #72414 [NEW]: MSSQL BindParam with UTF8 Character then Char modified
| From: | sungtae542 at gmail dot com | Date: | Wed, 15 Jun 2016 14:48:31 +0000 |
| Subject: | Bug #72414 [NEW]: MSSQL BindParam with UTF8 Character then Char modified | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201654@lists.php.net to get a copy of this message | ||
From: sungtae542 at gmail dot com
Operating system: Ubunbu 16.04
PHP version: 7.0.7
Package: PDO DBlib
Bug Type: Bug
Bug description:MSSQL BindParam with UTF8 Character then Char modified
Description:
------------
MSSQL BindParam with UTF8 Character in PHP 7.0.4 and PHP 7.0.7
then UTF8 character is modified.
PHP 5.5.6 is OK.
PHP 7.0 without bindparam and just pdo-dblib with UTF8 is ok.
PHP 7.0 with bindparam pdo-mysql UTF8 is ok.
PHP 7.0.4-7ubuntu2.1 (Ubuntu 16.04 Package)
PHP 7.0.7 (php-7.0.7.tar.gz)
Ubuntu 16.04 + PHP7.0.4 PDO_dblib + parambind(UTF8) + mssql : Fail
Ubuntu 16.04 + PHP7.0.7 PDO_dblib + parambind(UTF8) + mssql : Fail
Ubuntu 16.04 + PHP7.0.? PDO_dblib + parambind(Ansi) + mssql : OK
Ubuntu 14.04 + PHP5.5.9 PDO_dblib + parambind(UTF8) + mssql : OK
Ubuntu 16.04 + PHP7.0.4 PDO_dblib + UTF8 query + mssql : OK
Ubuntu 16.04 + PHP7.0.4 PDO_mysql + parambind(UTF8) + mysql : OK
Ubuntu 16.04 + freetds + tsql + mssql : OK
Test script:
---------------
# with bindparam
$pdo = new PDO("dblib:host=$dbIp;dbname=$dbName;charset=UTF-8", $dbId,
$dbPw);
#$username = 'username1';
$username = 'íê¸';
$sth = $pdo->prepare("select * from test_table where username =
:username");
$sth->bindParam (':username', $username);
$sth->execute();
$row = $sth->fetch(PDO::FETCH_OBJ);
var_dump($row);
#without bindparam
$pdo = new PDO("dblib:host=$dbIp;dbname=$dbName;charset=UTF-8", $dbId,
$dbPw);
#$username = 'username1';
$username = "'" . "íê¸" . "'";
$sth = $pdo->prepare("select * from test_table where username =
$username");
$sth->execute();
$row = $sth->fetch(PDO::FETCH_OBJ);
var_dump($row);
Expected result:
----------------
freetds debug log and MSSQL Profiler log is following
select * from test_table where username = 'íê¸'
Actual result:
--------------
freetds debug log and MSSQL Profiler log is following
select * from test_table where username = 0x27ed959ceab88027
--
Edit bug report at https://bugs.php.net/bug.php?id=72414&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72414&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72414&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72414&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72414&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72414&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72414&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72414&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72414&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72414&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72414&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72414&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72414&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72414&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72414&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72414&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72414&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72414&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72414&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72414&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72414&r=mysqlcfg