Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-121

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: PHP-8.4.1
    • Fix Version/s: PHP 9.1.0 0004
    • Component/s: PHP Driver
    • Labels:
      None

      Description

      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

      <?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);
      ?>
      

      Actual result:

      [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!
      

      Expect result:

      bind '25:22:60','time' failed
      

      Result in database:

      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> 
      

        Activity

        Hide
        hellohuizhang 张慧 added a comment -

        I have tested it on CCI. The test file "test_bind_time.c" is in the attachment, maybe it is a bug for CCI.

        Show
        hellohuizhang 张慧 added a comment - I have tested it on CCI. The test file "test_bind_time.c" is in the attachment, maybe it is a bug for CCI.
        Hide
        xiaoshan78 李成龙[이성룡] added a comment -

        CCI bug

        Show
        xiaoshan78 李成龙[이성룡] added a comment - CCI bug
        Hide
        zoujing ZouJing added a comment -

        Caused by cci

        Show
        zoujing ZouJing added a comment - Caused by cci
        Hide
        zoujing ZouJing added a comment -
        Show
        zoujing ZouJing added a comment - CUBRIDSUS-7159
        Hide
        cn15800 谢韦华[Bert] added a comment -

        cci 9.1.0:

        bind time success
        Warning: Error: DBMS, -787, Conversion error in time format. in /mnt/hgfs/share/share_build/nginx_clent/script/apis121.php on line 18
        bool(false) Finished!

        Show
        cn15800 谢韦华[Bert] added a comment - cci 9.1.0: bind time success Warning: Error: DBMS, -787, Conversion error in time format. in /mnt/hgfs/share/share_build/nginx_clent/script/apis121.php on line 18 bool(false) Finished!
        Hide
        ryin005 Ray Yin added a comment -

        Added a test case for the issue

        [php@NC-PL-QA011 _14_issues]$ svn ci --username ray -m "[APIS-121] Add a case to test when passing a invalid time to cubrid_bind()"
        Adding         _14_issues/bug_apis_121
        Adding         _14_issues/bug_apis_121/cases
        Adding         _14_issues/bug_apis_121/cases/bug_apis_121.phpt
        Adding         _14_issues/bug_apis_121/cases/bug_apis_121.sh
        Adding         _14_issues/bug_apis_121/cases/connect.inc
        Transmitting file data ...
        Committed revision 1977.
        

        URL: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/tests2/php/_14_issues/bug_apis_121/

        Show
        ryin005 Ray Yin added a comment - Added a test case for the issue [php@NC-PL-QA011 _14_issues]$ svn ci --username ray -m "[APIS-121] Add a case to test when passing a invalid time to cubrid_bind()" Adding _14_issues/bug_apis_121 Adding _14_issues/bug_apis_121/cases Adding _14_issues/bug_apis_121/cases/bug_apis_121.phpt Adding _14_issues/bug_apis_121/cases/bug_apis_121.sh Adding _14_issues/bug_apis_121/cases/connect.inc Transmitting file data ... Committed revision 1977. URL: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/tests2/php/_14_issues/bug_apis_121/
        Hide
        ryin005 Ray Yin added a comment -

        Test OS: Linux 32/64, Windows 32/64
        CUBRID Server: CUBRID 9.1 (9.1.0.0212)
        PHP Version: PHP 5.4.15
        CUBRID-PHP: 9.1.0.0004 svn: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/
        Test Tool: PHP Tester (PHPT)

        Test Result: Pass

        Notes: similar as APIS-120, the error message is returned from cubrid_execute() but not cubrid_bind(), it could be ok since the error is caused by that DBMS doesn't support the overbound time data like '25:20:60'. The cubrid_bind() only returns false if the $bind_value doesn't match $bind_value_type

        Show
        ryin005 Ray Yin added a comment - Test OS: Linux 32/64, Windows 32/64 CUBRID Server: CUBRID 9.1 (9.1.0.0212) PHP Version: PHP 5.4.15 CUBRID-PHP: 9.1.0.0004 svn: http://svn.cubrid.org/cubridapis/php/branches/RB-9.1.0_static_cci/ Test Tool: PHP Tester (PHPT) Test Result: Pass Notes: similar as APIS-120 , the error message is returned from cubrid_execute() but not cubrid_bind(), it could be ok since the error is caused by that DBMS doesn't support the overbound time data like '25:20:60'. The cubrid_bind() only returns false if the $bind_value doesn't match $bind_value_type

          People

          • Assignee:
            cn14130 欧明宝[Bom Owen]
            Reporter:
            zoujing ZouJing
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: