PHPCMS 错误日志 Only variables should be passed by ...

有几个网站是PHPCMS V9作的,但这两天发现一个问题,PHPCMS 的错误日志超过了20M ,后台报警,而后我看了下错误日志,其中两万多行都是一个错误,错误信息以下:php


1 <?php exit;?>11-03 10:24:46 | 2048 | Only variables should be passed by reference | caches/caches_model/caches_data/content_output.class.php | 79

而后查找 根源 caches/caches_model/caches_data/content_output.class.php 的第79行 数组

 

1 extract(string2array($this->fields[$field]['setting']));

PHP extract() 函数从数组中把变量导入到当前的符号表中。
对于数组中的每一个元素,键名用于变量名,键值用于变量值。 缓存


因而我怀疑extract()的参数不是数组 形成的。 函数

因为报错的这个位置试过缓存文件,找到源文件的位置为 网站

网站根目录/phpcms/modules/content/fields/box/output.inc.php
this

修改文件里面的 spa


1 extract(string2array($this->fields[$field]['setting']));
为:
1 $setting = string2array($this->fields[$field]['setting']); is_array($setting) && extract($setting);


这样,先判断下extract()的参数是否是一个数组,若是是数组的话,才执行extract(),这样就避免错误, 日志

而后在PHPCMS 更新缓存,这样后面就不会报错了 code

相关文章
相关标签/搜索