|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-06-07 00:49 UTC] smorozov at sugarcrm dot com
Description:
------------
The issue is reproducible in the following environment:
1. PHP 7.1(.5), IBM DB2 10.5. Not reproducible on PHP 5.6.30 and PHP 7.0.19 in the exact same environment.
2. A boolean value is bound to an integer column (e.g. a SMALLINT).
3. The boolean value is not a literal but a result of comparison of an array element to a string literal (just comparing strings will not work, see example).
4. The query in question is not the first query executed after connecting to the DB.
Test script:
---------------
/*
CREATE TABLE DB2_TEST
(
ID smallint DEFAULT 0
)
*/
$dsn = 'HOSTNAME=localhost;UID=db2inst1;PWD=Passw0rd;DATABASE=test';
$conn = db2_connect($dsn, null, null);
if (!$conn) {
echo db2_conn_errormsg(), PHP_EOL;
exit(1);
}
printf('PHP: %s' . PHP_EOL, phpversion());
printf('ibm_db2: %s' . PHP_EOL, phpversion('ibm_db2'));
$server = db2_server_info($conn);
printf('DB2 NAME: %s, VERSION: %s' . PHP_EOL, $server->DBMS_NAME, $server->DBMS_VER);
// without executing a query before the following one, the issue is not reproducible
$stmt = db2_prepare($conn, 'SELECT 1 FROM SYSIBM.SYSDUMMY1');
$result = db2_execute($stmt);
if (!$result) {
echo db2_stmt_errormsg(), PHP_EOL;
exit(1);
}
// the value of $true is the result of comparison of an array element value
// with the same value. if it's just literal true, the issue is not reproducible
$array = array('key' => 'value');
$true = $array['key'] == 'value';
$stmt = db2_prepare($conn, 'SELECT ID FROM DB2_TEST WHERE ID = ?');
$result = db2_execute($stmt, [$true]);
if (!$result) {
echo db2_stmt_errormsg(), PHP_EOL;
exit(1);
}
echo 'OK', PHP_EOL;
Expected result:
----------------
The second call to db2_execute() is expected to return TRUE. OK is displayed.
Actual result:
--------------
[IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003 SQLCODE=-99999
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 07:00:01 2025 UTC |
Surprisingly, the issue is not reproducible on PHP 7.1.7 but is still reproducible on a freshly built PHP 7.1.5: ↪ php test.php PHP: 7.1.5 ibm_db2: 1.9.9 DB2 NAME: DB2/LINUXX8664, VERSION: 10.05.0005 Warning: db2_execute(): Statement Execute Failed in test.php on line 31 Call Stack: 0.0002 360968 1. {main}() test.php:0 0.0494 383384 2. db2_execute() test.php:31 [IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003 SQLCODE=-99999 ↪ php test.php PHP: 7.1.7 ibm_db2: 1.9.9 DB2 NAME: DB2/LINUXX8664, VERSION: 10.05.0005 OK