Bug #75018 [NEW]: Data corruption when reading fields of bit type
| From: | ale5000 at gmail dot com | Date: | Tue, 01 Aug 2017 14:19:32 +0000 |
| Subject: | Bug #75018 [NEW]: Data corruption when reading fields of bit type | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210448@lists.php.net to get a copy of this message | ||
From: ale5000 at gmail dot com
Operating system: Windows 7 64-bit
PHP version: 7.1.7
Package: MySQLi related
Bug Type: Bug
Bug description:Data corruption when reading fields of bit type
Description:
------------
It corrupt data when reading fields of bit type.
See the sample code.
The problem is possibly Windows specific but I'm not sure.
Test script:
---------------
<?php
$username = 'root';
$password = '';
$database_name = 'test_db';
$mysqli = new mysqli('127.0.0.1', $username, $password,
$database_name);
if($mysqli->connect_errno) die('Error');
$sql = "CREATE TABLE test (bit_column_1 bit(1) NOT NULL) DEFAULT
CHARSET=utf8";
$mysqli->query($sql);
$sql = "INSERT INTO test (bit_column_1) VALUES (0)";
$mysqli->query($sql);
$sql = "SELECT bit_column_1 FROM test";
if(!$result = $mysqli->query($sql)) die('Failed');
$row = $result->fetch_assoc();
echo "Result: ".$row['bit_column_1'];
Expected result:
----------------
0
Actual result:
--------------
668556962937438208
--
Edit bug report at https://bugs.php.net/bug.php?id=75018&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75018&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75018&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75018&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75018&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75018&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75018&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75018&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75018&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75018&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75018&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75018&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75018&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75018&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75018&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75018&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75018&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75018&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75018&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75018&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75018&r=mysqlcfg