消息关闭
    暂无新消息!
testlink用例执行,点击具体用例的时候报错;Cannot use string offset as an array    求大神帮忙啊


13个回答

︿ 3
testlink 19.16版本  windows10环境, 代码没有动过,就是安装后新建case,执行case就报错了
︿ 2
    list($tcase_id,$tcversion_id) = processTestCase($tcase,$gui,$args,$cfg,$linked_tcversions,
94行                                                    $tree_mgr,$tcase_mgr,$attachmentRepository);

    $dummy = $tree_mgr->get_node_hierarchy_info($args->version_id);
    
    $audit = $gui->bug_summary = $tcase_mgr->getAuditSignature((object)array('id' => $dummy['parent_id'])); 
    $ts = sprintf(lang_get('execution_ts_iso'), date('Y-m-dTH:i',time()));
    $gui->bug_summary .= (' ' . $ts);

    $lk = current($linked_tcversions);
    $gui->direct_link = trim($_SESSION['basehref'],'/') . 
                        "/ltx.php?item=exec&feature_id=" . $lk[0]['feature_id'] .
                        "&build_id=" . $args->build_id;

    $args->direct_link = $gui->direct_link;



{
    $finalFilters=$cf_filters+$filterValue;
1533行    $guiObj->design_time_cfields[$tcase_id][$locationKey] = 
      $tcaseMgr->html_table_of_custom_field_values($tcase_id,'design',$finalFilters,null,null,
                                                   $argsObj->tproject_id,null,$tcversion_id);
      
    $guiObj->testplan_design_time_cfields[$tcase_id] = 
      $tcaseMgr->html_table_of_custom_field_values($tcversion_id,'testplan_design',$cf_filters,
                                                   null,null,$argsObj->tproject_id,null,$link_id);
  }

是这样截取吗? 错误行数有标注
︿ 2
没有代码是不能分析出错的原因的
猜测一下
$far='boo';
$far[0][]='boo';
这样会报  Cannot use string offset as an array 错误
如果你的情况类似的话,显然是你传递的参数是错误的!
因为发行的系统是不会出现这类低级错误的
︿ 1
1
function processTestCase($tcase,&$guiObj,&$argsObj,&$cfgObj,$tcv,&$treeMgr,&$tcaseMgr,&$docRepository)
{     

  
  // IMPORTANT due  to platform feature
  // every element on linked_tcversions will be an array.
  $cf_filters=array('show_on_execution' => 1); 
  $locationFilters=$tcaseMgr->buildCFLocationMap();
  $guiObj->design_time_cfields='';
  $guiObj->testplan_design_time_cfields='';
  
  $tcase_id = isset($tcase['tcase_id']) ? $tcase['tcase_id'] : $argsObj->id;
2
function processTestCase($tcase,&$guiObj,&$argsObj,&$cfgObj,$tcv,&$treeMgr,&$tcaseMgr,&$docRepository)
{     

  
  // IMPORTANT due  to platform feature
  // every element on linked_tcversions will be an array.
  $cf_filters=array('show_on_execution' => 1); 
  $locationFilters=$tcaseMgr->buildCFLocationMap();
  $guiObj->design_time_cfields='';
  $guiObj->testplan_design_time_cfields='';
  
  $tcase_id = isset($tcase['tcase_id']) ? $tcase['tcase_id'] : $argsObj->id;
3
foreach($locationFilters as $locationKey => $filterValue)
  {
    $finalFilters=$cf_filters+$filterValue;
    $guiObj->design_time_cfields[$tcase_id][$locationKey] = 
      $tcaseMgr->html_table_of_custom_field_values($tcase_id,'design',$finalFilters,null,null,
                                                   $argsObj->tproject_id,null,$tcversion_id);
      
    $guiObj->testplan_design_time_cfields[$tcase_id] = 
      $tcaseMgr->html_table_of_custom_field_values($tcversion_id,'testplan_design',$cf_filters,
                                                   null,null,$argsObj->tproject_id,null,$link_id);
  }
4
foreach($locationFilters as $locationKey => $filterValue)
  {
    $finalFilters=$cf_filters+$filterValue;
    $guiObj->design_time_cfields[$tcase_id][$locationKey] = 
      $tcaseMgr->html_table_of_custom_field_values($tcase_id,'design',$finalFilters,null,null,
                                                   $argsObj->tproject_id,null,$tcversion_id);
      
    $guiObj->testplan_design_time_cfields[$tcase_id] = 
      $tcaseMgr->html_table_of_custom_field_values($tcversion_id,'testplan_design',$cf_filters,
                                                   null,null,$argsObj->tproject_id,null,$link_id);
  }
5
 foreach($locationFilters as $locationKey => $filterValue)
          {
            $finalFilters = $cf_filters+$filterValue;
            $guiObj->design_time_cfields[$testcase_id][$locationKey] = 
                     $tcaseMgr->html_table_of_custom_field_values($testcase_id,'design',$finalFilters,null,null,
                                                                  $argsObj->tproject_id,null,$testSet->tcversion_id[$gdx]);

            $guiObj->testplan_design_time_cfields[$testcase_id] = 
                     $tcaseMgr->html_table_of_custom_field_values($testcase_id,'testplan_design',$cf_filters,
                                                                         null,null,$argsObj->tproject_id);
                                                                                          
          }                    
6
 foreach($locationFilters as $locationKey => $filterValue)
          {
            $finalFilters = $cf_filters+$filterValue;
            $guiObj->design_time_cfields[$testcase_id][$locationKey] = 
                     $tcaseMgr->html_table_of_custom_field_values($testcase_id,'design',$finalFilters,null,null,
                                                                  $argsObj->tproject_id,null,$testSet->tcversion_id[$gdx]);

            $guiObj->testplan_design_time_cfields[$testcase_id] = 
                     $tcaseMgr->html_table_of_custom_field_values($testcase_id,'testplan_design',$cf_filters,
                                                                         null,null,$argsObj->tproject_id);
                                                                                          
          }                  
搜索有6个地方,帮忙看下
︿ 1
Fatal error: Uncaught Error: Cannot use string offset as an array in C:\xampp\htdocs\testlink\lib\execute\execSetResults.php:1533 Stack trace: #0 C:\xampp\htdocs\testlink\lib\execute\execSetResults.php(94): processTestCase(NULL, Object(stdClass), Object(stdClass), Object(stdClass), Array, Object(tree), Object(testcase), Object(tlAttachmentRepository)) #1 {main} thrown in C:\xampp\htdocs\testlink\lib\execute\execSetResults.php on line 1533

我这有类似错误,大神帮忙看下
︿ 0
这个 $guiObj->design_time_cfields='' 显然是错误的
既然后面把 $guiObj->design_time_cfields当作数组使用,自然就不能将他赋值成空串(虽然低版本 php是可以的)
应改为 $guiObj->design_time_cfields=[] (空数组)
︿ 0
string(0) "" 
Fatal error: Uncaught Error: Cannot use string offset as an array in C:\xampp\htdocs\testlink\lib\execute\execSetResults.php:1534 Stack trace: #0 C:\xampp\htdocs\testlink\lib\execute\execSetResults.php(94): processTestCase(NULL, Object(stdClass), Object(stdClass), Object(stdClass), Array, Object(tree), Object(testcase), Object(tlAttachmentRepository)) #1 {main} thrown in C:\xampp\htdocs\testlink\lib\execute\execSetResults.php on line 1534

这样子的
︿ 0
design_time_cfields 属性在哪里赋值的,请找一下贴出来(可能有多次赋值)