dongzhi9906 2012-02-17 12:11
浏览 51
已采纳

我的数组以什么方式索引'非法字符串偏移'?

When "future-proofing" code by testing it on PHP 5.4, I get a warning I don't understand.

function __clone() {
  $this->changed = TRUE;
  foreach ($this->conditions as $key => $condition) {
    if (
    $condition['field']
    instanceOf QueryConditionInterface) {
      $this->conditions[$key]['field'] = clone($condition['field']);
    }
  }
}

I broke out $condition['field'] into its own row to reduce the amount of code to focus on. About that specific line, PHP has this to say

Warning: Illegal string offset 'field' in DatabaseCondition->__clone()

And I just can't see how 'field', is an illegal string offset. I'm guessing that I'm just missing something obvious, but if the community can't find a problem, I'll file a bug report.

I interpret the warning as "Under no circumstances is 'field' a valid key". This error would have made sense if I had tried to us for example an array as a key.

  • 写回答

2条回答 默认 最新

  • doufangpian5545 2012-02-17 21:17
    关注

    The warning looks like its saying that $condition is a string. Without any knowledge of the code I don't whether that makes any sense.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题