php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67983 mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to interpret bit columns
Submitted: 2014-09-08 17:57 UTC Modified: 2014-09-09 09:23 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: tenzzor at gmail dot com Assigned: andrey
Status: Assigned Package: MySQLi related
PHP Version: 5.6.0 OS: Linux Ubuntu
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-09-08 17:57 UTC] tenzzor at gmail dot com
Description:
------------
mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to interpret bit columns. It always returns int 0 regardless of actual column value.
I found a passing test https://github.com/php/php-src/blob/master/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt but it's only checking for value=0.


Test script:
---------------
<?php
$connection = mysqli_init();
mysqli_options($connection, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, TRUE);
mysqli_real_connect($connection, '127.0.0.1', 'root', '', 'test');

mysqli_set_charset($connection, 'utf8');
mysqli_query($connection, 'DROP TABLE IF EXISTS test');
mysqli_query($connection, 'CREATE TABLE test (id BIT(1))');
mysqli_query($connection, 'INSERT INTO test VALUES (1)');

$res = mysqli_query($connection, 'SELECT * FROM test');

$result = mysqli_fetch_assoc($res);

var_dump($result['id']);

Expected result:
----------------
int(1) or string(1)

Actual result:
--------------
int(0)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-09 09:23 UTC] andrey@php.net
-Status: Open +Status: Assigned
 [2014-09-09 09:23 UTC] andrey@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: andrey
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC