Fatal error: Cannot use assign-op operators with overloaded objects nor string offsets

心不动则不痛 提交于 2019-12-01 19:28:36

I know this isn't a version problem, but could not tell you what it actually is. I just ran across the same issue on my localhost. It worked in one app, not the other, running php5.59.

Inspect the code, it is probably something like this:

$data[2] .= $additionaldata;

It needs to be changed to

$data[2] = $data[2].$additionaldata;

I had the same issue! In my case, I declared a variable with an array and by mistake I just used it in another moment! Something like that:

$myArr = array();
// ...

$myArr = 'Some text';
// ...

$myArr[4] += 1; // Here the error shows!

So, basically.. I was trying to add 1 in a string. Then I just changed the string variable to another name and the problem was solved:

$someLabel = 'Some text';

I hope it helps you in your issue!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!