Menu

#101 [PHP]Return value is not false when passing a invalid time to cubrid_bind method

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

Test Build: CUBRID 2008 R4.1 (8.4.1.1018) (64bit release build for linux_gnu)
OS: Linux 64
Description: Return value is not false when passing a invalid time to cubrid_bind method

Repro steps:
1. execute: php bind_time_test3.phpt
statements in bind_time_test3.phpt
{noformat}
?php
$conn = cubrid_connect(localhost, 33113, phpdb);
cubrid_execute($conn, 'DROP TABLE IF EXISTS time2_tb');

//time2_tb
cubrid_execute($conn,CREATE TABLE time2_tb(c1 int, c2 time, c3 date, c4 TIMESTAMP););
$req2 = cubrid_prepare($conn, INSERT INTO time2_tb VALUES(1,?,?,?););
if(false == ($tmp=cubrid_bind($req2, 1, '25:22:60','time'))){
printf(bind '25:22:60','time' failed \n);
}else{
printf(bind time success\n);
}

//cubrid_bind($req2, 1, '02:22:59','time');

cubrid_bind($req2, 2, '2012-03-02');
cubrid_bind($req2, 3, '08/14/1977 12:36:10 pm');
cubrid_execute($req2);

$req3= cubrid_execute($conn, SELECT * FROM time2_tb);
if($req3){
$result = cubrid_fetch_assoc($req3);
var_dump($result);
cubrid_close_prepare($req3);
}

print Finished!\n;
cubrid_disconnect($conn);
?
{noformat}

Actual result:
{noformat}
[php@NC-PL-QA014 _02_prepare]$ php bind_time_test3.phpt
bind time success
array(4) {
[c1]=
string(1) 1
[c2]=
string(8) 00:00:-1
[c3]=
string(10) 2012-03-02
[c4]=
string(19) 1977-08-14 12:36:10
}
Finished!
{noformat}

Expect result:
{noformat}
bind '25:22:60','time' failed
{noformat}

Result in database:
{noformat}
csql select * from time2_tb;

=== Result of SELECT Command in Line 3 ===

c1 c2 c3 c4

1 11:59:59 PM 03/02/2012 12:36:10 PM 08/14/1977

1 rows selected.

Current transaction has been committed.

1 command(s) successfully processed.
csql
{noformat}

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.