PHPCMS 錯誤日志 Only variables should be passed by ...


有幾個網站是PHPCMS V9做的,但這兩天發現一個問題,PHPCMS 的錯誤日志超過了20M ,后台報警,然后我看了下錯誤日志,其中兩萬多行都是一個錯誤,錯誤信息如下:


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

修改文件里面的


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


這樣,先判斷下extract()的參數是不是一個數組,如果是數組的話,才執行extract(),這樣就避免錯誤,

然后在PHPCMS 更新緩存,這樣后面就不會報錯了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM