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

[PHP]Segment default will appear when calling cubrid_list_dbs() method

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: PHP-8.4.1
    • Fix Version/s: PHP-8.4.1, PHP-Apricot
    • 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:
      When no passing parameter to cubrid_list_dbs() method, segment default will appear.

      Repro steps:
      1. gdb php
      2. run list_dbs_test.phpt
      3. bt
      statement in list_dbs_test.phpt

      $conn = cubrid_connect("localhost", 33009, "demodb");
      
      $db_list = cubrid_list_dbs($conn);
      var_dump($db_list);
      //no parameter
      $db_list2 = cubrid_list_dbs();
      var_dump($db_list2);
      
      cubrid_disconnect($conn);
      
      print "Finished!\n";
      

      Actual result:

      array(1) {
        [0]=>
        string(6) "demodb"
      }
      Segmentation fault
      

      Comments:

      [php@NC-PL-QA-013 tests]$ gdb php
      ...............
      (gdb) run list_dbs_test.phpt 
      Starting program: /home/php/opt/php/bin/php list_dbs_test.phpt
      [Thread debugging using libthread_db enabled]
      [New Thread 0x2b50829d4670 (LWP 7288)]
      array(1) {
        [0]=>
        string(6) "demodb"
      }
      
      {color:red}
      Program received signal SIGSEGV, Segmentation fault.
      0x000000000067374b in zend_fetch_resource (passed_id=0x7fff280e4f00, default_id=-1, resource_type_name=0x2b508604f500 "CUBRID-Connect", 
          found_resource_type=0x0, num_resource_types=2) at /home/php/install_file/php-5.3.2/Zend/zend_list.c:127
      127                     } else if ((*passed_id)->type != IS_RESOURCE) {
      {color}
      (gdb) bt
      #0  0x000000000067374b in zend_fetch_resource (passed_id=0x7fff280e4f00, default_id=-1, 
          resource_type_name=0x2b508604f500 "CUBRID-Connect", found_resource_type=0x0, num_resource_types=2)
          at /home/php/install_file/php-5.3.2/Zend/zend_list.c:127
      #1  0x00002b5086046962 in zif_cubrid_list_dbs (ht=0, return_value=0xbfbbe08, return_value_ptr=<value optimized out>, 
          this_ptr=<value optimized out>, return_value_used=<value optimized out>) at /home/php/php/trunk/php_cubrid.c:4333
      #2  0x00000000006af379 in zend_do_fcall_common_helper_SPEC (execute_data=0x2b5086683050)
          at /home/php/install_file/php-5.3.2/Zend/zend_vm_execute.h:313
      #3  0x0000000000686e6c in execute (op_array=0xbfbc5b0) at /home/php/install_file/php-5.3.2/Zend/zend_vm_execute.h:104
      #4  0x0000000000664cdd in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/php/install_file/php-5.3.2/Zend/zend.c:1194
      #5  0x000000000061542d in php_execute_script (primary_file=0x7fff280e7640) at /home/php/install_file/php-5.3.2/main/main.c:2260
      #6  0x00000000006e89cc in main (argc=2, argv=0x7fff280e78b8) at /home/php/install_file/php-5.3.2/sapi/cli/php_cli.c:1192
      (gdb) 
      

        Activity

        Hide
        hellohuizhang 张慧 added a comment -

        Commit rev: 490

        Show
        hellohuizhang 张慧 added a comment - Commit rev: 490
        Hide
        zoujing ZouJing added a comment -

        Test build : CUBRID 2008 R4.1 (8.4.1.1018)
        OS: Linux 64bit
        Test Result: PASS
        so i close it

        Show
        zoujing ZouJing added a comment - Test build : CUBRID 2008 R4.1 (8.4.1.1018) OS: Linux 64bit Test Result: PASS so i close it

          People

          • Assignee:
            zoujing ZouJing
            Reporter:
            zoujing ZouJing
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: