php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66525 Mysqli::thread_id limited in 32bit int.
Submitted: 2014-01-21 03:08 UTC Modified: 2014-02-25 12:25 UTC
From: aleiphoenix at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.5.8 OS: Linux x86_64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aleiphoenix at gmail dot com
New email:
PHP Version: OS:

 

 [2014-01-21 03:08 UTC] aleiphoenix at gmail dot com
Description:
------------
When MySQL connection_id goes larger then 2**31, Mysqli::thread_id just return the wrong value.


tested version

PHP 5.5.7 on Gentoo Linux x86_64
PHP 5.2.14 on RHEL 5.5 x86_64

Test script:
---------------
<?php

$mysql = new Mysqli('127.0.0.1', 'batchjob', 'aN2jU3ke', 'anjuke_db');

$_id = $mysql->thread_id;

var_dump($_id);

$sql = 'select connection_id()';

$res = $mysql->query($sql);

var_dump($res->fetch_row()[0]);

sleep(30);

$mysql->close();


Expected result:
----------------
result of Mysqli::thread_id is the same as result of `select connection_id()` statement.

Actual result:
--------------
Mysqli::thread_id: 2804557258
select connection_id(): 11394491850


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-25 12:25 UTC] uw@php.net
-Status: Open +Status: Not a bug
 [2014-02-25 12:25 UTC] uw@php.net
mysql::thread_id is taken from the C/S protocol. The C/S protocol is using 32bit. Hence, any consumer, such as PHP, is limited to 32bit. If you consider this an error, report it at MySQL.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 02:01:29 2024 UTC