於views啟用tracker後~然後最新文章的我的最新文章就出現以下的錯誤訊息~但若關掉「啟用」就正常~>w<好奇怪
想詢問大家有遇到這問題嘛?
我的views是6.x-2.6版的
tracker是6.10版的
而drupal是6.14版的~
--------------------------------------------------------------------------------
* warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in D:\AppServ\www\web2\sites\all\modules\views\includes\view.inc on line 1245.
* warning: mysqli_real_escape_string() expects parameter 2 to be string, object given in D:\AppServ\www\web2\includes\database.mysqli.inc on line 323.
* warning: Illegal offset type in D:\AppServ\www\web2\sites\all\modules\views\includes\view.inc on line 1249.
* warning: Illegal offset type in D:\AppServ\www\web2\sites\all\modules\views\includes\view.inc on line 1284.
* warning: Illegal offset type in isset or empty in D:\AppServ\www\web2\sites\all\modules\views\views.module on line 699.
------------------------------------------------------------------------------------------
附加檔案 | 大小 |
---|---|
![]() | 18.68 KB |
Re: ...
我查看了我的c:\xampp\htdocs\drupal\sites\all\modules\views\includes\view.inc:
在1279行(如下),有array_key_exists這個function,而且整個file只有這一行有該function。
if (!array_key_exists($arg, $cache) || $reset) {
再用array_key_exists股溝搜尋至 http://php.net/manual/en/function.array-key-exists.php ,這是PHP對array_key_exists($arg, $cache)的document,往下讀到Changelog,發現,對於PHP 5.3.0,
------This function doesn't work with objects anymore, property_exists() should be used in this case.
再follow property_exists link 至 http://www.php.net/manual/en/function.property-exists.php ,其format為:
bool property_exists ( mixed $class , string $property )
和array_key_exists($arg, $cache)的format(如下行) 樣子差不多,
bool array_key_exists ( mixed $key , array $search )
注意:看array_key_exists 的第一個parameter,mixed $key 。看來在PHP 5.3.0之前,$key可以是mix type,PHP 5.3.0之後非得是string or an integer (見你文中的warning)。
因此,猜想,應是將
if (!array_key_exists($arg, $cache) || $reset) {
改為
if (!property_exists ($arg, $cache) || $reset) {
最近玩了一下幾個類似問題,心得如下:
drupal架站的warning PHP問題解法( http://drupaltaiwan.org/forum/20091128/3862 )
p.s.