Menu

#124 [PHP]Return value is not false when passing a not-numeric value to cubrid_set_query_timeout method

open
nobody
None
5
2012-03-14
2012-03-14
Jira Trac
No

Test Build: CUBRID 2008 R4.1 (8.4.1.1018) (64bit release build for linux_gnu)
OS: Linux 64
Description:
Passing '20ii' to [cubrid_set_query_timeout|http://www.php.net/manual/en/function.cubrid-set-query-timeout.php] method, return value is not false.
and using cubrid_get_query_timeout method will get the value and the value is 20.

Repro steps:
1. execute time_test2.phpt
statements in time_test2.phpt
{noformat}
$host = localhost;
$port = 33113;
$db = demodb;
$conn = cubrid_connect_with_url(CUBRID:$host:$port:$db:::?login_timeout=5000query_timeout=5000disconnect_on_query_timeout=yes);
cubrid_execute($conn, DROP TABLE if exists timeout2_tb);
cubrid_execute($conn, create table timeout2_tb(id int, name varchar(10)));
cubrid_execute($conn, insert into timeout2_tb values(1,'nameq'),(2,'name2'),(3,'name3'));
$req1 = cubrid_execute($conn, SELECT * FROM timeout2_tb);
$set7=cubrid_set_query_timeout($req1,'10');
if(FALSE == $set7){
printf([007]Expect false,[%d] [%d] [%s]\n,cubrid_error_code_facility(), cubrid_errno($conn), cubrid_error($conn));
}else{
$timeout7 = cubrid_get_query_timeout($req1);
printf([007]timeout: %d\n,$timeout7);
}

$set10=cubrid_set_query_timeout($req1,'20ii');
if(FALSE == $set10){
printf([0010]Expect false,[%d] [%d] [%s]\n,cubrid_error_code_facility(), cubrid_errno($conn), cubrid_error($conn));
}else{
$timeout10 = cubrid_get_query_timeout($req1);
printf([0010]timeout: %d\n,$timeout10);
}
cubrid_close_prepare($req1);
cubrid_disconnect($conn);
{noformat}

Actual result:
{noformat}
[007]timeout: 10
PHP Notice: A non well formed numeric value encountered in /home/php/phpTestcases/_06_commit/bug/time_test2.phpt on line 20
[0010]timeout: 20
{noformat}

Expect resutl:
Maybe the return value will be false when the passing value is not int type.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.