Skip to main content

Fatal error: Unsupported operand types in /home/thomas/public_html/drupal/includes/common.inc on line 1376

有位好朋友,在水隆投上發現了一個錯誤發生:Fatal error: Unsupported operand types in /home/thomas/public_html/drupal/includes/common.inc on line 1376

緊接著趕緊到drupal.org上搜查一下,得知這可能是某個模組在drupal5轉drupal6時傳遞參數給url()時所發生的錯誤。

這裡有篇Troubleshooting FAQ, 說到如何找出產生錯誤的模組。在我們找出錯誤模組後,可以到該模組的Issue中尋找解決之道,如果沒有找到可以發佈一篇bug report請模組維護者協助解決。

這篇文章寫道,需要將原本的common.inc中的程式段進行修改,以便於系統告訴我們那個模組出錯了。

以下的程式段您可以在include/common.inc 中,大約1300行左右可以找到。

<?php
function url($path = NULL, $options = array()) {
 
// Merge in defaults.
 
$options += array(
   
'fragment' => '',
   
'query' => '',
   
'absolute' => FALSE,
   
'alias' => FALSE,
   
'prefix' => ''
 
);
?>

將他修改為

<?php
function url($path = NULL, $options = array()) {
  if (!
is_array($options)) {
    echo
"<pre>";
   
$backtrace = debug_backtrace();
   
var_export($backtrace[0]);
    die();
  }
 
// Merge in defaults.
 
$options += array(
   
'fragment' => '',
   
'query' => '',
   
'absolute' => FALSE,
   
'alias' => FALSE,
   
'prefix' => ''
 
);
?>

那麼,我們得到的反饋就會如下所示:

array (
  'file' => '/www/drupal-6/sites/all/modules/admin_links/admin_links.module',
  'line' => 65,
  'function' => 'url',
  'args' =>
  array (
    0 => 'node/62/edit',
    1 => NULL,
    2 => NULL,
    3 => true,
  ),
)

這個訊息將會取代原本"Fatal error: Unsupported operand types in /home/thomas/public_html/drupal/includes/common.inc on line 1376" 而新訊息中的file就是發生錯誤的模組,知道後就可以採取行動了。以上供您參考,並且萬分感謝各位好朋友的友情告知,謝謝。

Your rating: 平均分數: 4.6 (9 votes)

>w<…水大您好熱心唷!!讚讚讚…

>w<…水大您好熱心唷!!讚讚讚…

我喂人人,人人喂我嘛! 呵呵~~~

New Good Man's 的頭像

我喂人人,人人喂我嘛!

呵呵~~~

發表新回應

這個欄位的內容會保密,不會公開顯示。
  • 自動將網址與電子郵件位址轉變為連結。
  • 可使用的 HTML 標籤:<img> <a> <p> <br /> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><h1> <h2> <h3>
  • 自動斷行和分段。

更多關於格式選項的資訊

CAPTCHA
為了網站安全,請您輸入正確答案,謝謝。
Image CAPTCHA
Enter the characters (without spaces) shown in the image.