php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78259 PDO::PARAM_INT can't handle more then 2147483647
Submitted: 2019-07-06 14:55 UTC Modified: 2020-07-22 18:14 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: soheyb dot djellali at outlook dot com Assigned: cmb (profile)
Status: Not a bug Package: pdo_sqlsrv (PECL)
PHP Version: 7.3Git-2019-07-06 (Git) OS: Windows 10 x64 bit
Private report: No CVE-ID: None
 [2019-07-06 14:55 UTC] soheyb dot djellali at outlook dot com
Description:
------------
when ever i output data from sql using pdo bindparam 

if the output is integer and is (bigint) +2147483647 
it always come back 0 

Test script:
---------------
try{
$con = new PDO('sqlsrv:server=localhost;database=Telecaster','sa','');

$stmt = $con->prepare('{CALL cpanel_temp_gold(?)}');
$stmt->bindParam(1,$gold,PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT,255);
$stmt->execute();

echo number_format($gold);

}catch(PDOEXCEPTION $e){

	echo $e->getMessage();
}



Expected result:
----------------
actualle number

Actual result:
--------------
return 0 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-09 12:12 UTC] cmb@php.net
-Package: PDO related +Package: pdo_sqlsrv
 [2019-07-09 12:12 UTC] cmb@php.net
This is likely not a general PDO issue, but rather specific to
PDO_SQLSRV, and therefore it might be best to report it in its
issue tracker[1].  On a quick glance, the int cast[2] looks fishy,
since zend_long is 64bit wide on x64.

[1] <https://github.com/microsoft/msphpsql/issues>
[2] <https://github.com/microsoft/msphpsql/blob/3ba26932d8c835080de305c35c79035f3efa593f/source/pdo_sqlsrv/pdo_stmt.cpp#L239>
 [2020-07-22 18:14 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-07-22 18:14 UTC] cmb@php.net
Okay, I had a closer look.

Firstly, you are getting zero (well, actually NULL), because you
did not actually run the query.  Adding $stmt->fetchAll() after
$stmt->execute() would do this.

Then you would get 4294967295, but that is due to a bug in
pdo_sqlsrv[1].

[1] <https://github.com/microsoft/msphpsql/issues/1164>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC