« Movable Type 設置&カスタマイズ   カテゴリー内の前後のエントリーへのナビ(PHP) »

DynamicPublishing関係(?)のエラー対策(MTParentCategories)

May 26, 2005 20:56  [ Dynamic Pub., ]

カテゴリー別アーカイブで Dynamic Publishing にしたせいかMTParentCategoriesを使おうとすると block.MTParentCategories.php で以下のようなエラーが出た。

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of array_unshift(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in (略)/php/lib/block.MTParentCategories.php on line 7

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of array_push(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in (略)/php/lib/block.MTParentCategories.php on line 22

そこで指示通りに修正を掛けて
 7行目  array_unshift(&$list, 0); → array_unshift($list, 0)
 22行目 array_push(&$parents, 0); → array_push($parents, 0);
としてエラー回避。

参考にしたサイトはXREA SUPPORT BOARD - s39サーバーのPHP仕様について

要するにリファレンス渡しを修正したのですがリファレンス渡しの効果は上述のサイトからの引用で。

$num = 0; 
 
func_a($num); 
echo $num;    //当然0 
 
func_b($num); 
echo $num;    // 1が出力 
 
function func_a($num) { 
  $num++; 
} 
 
function func_b(&$num) { 
  $num++; 
} 

Trackback


まだトラックバックは寄せられていません。

Comments

まだコメントは寄せられていません。

Post a comment

コメント投稿フォーム

情報をブラウザに保存しますか ?

コメントにHTMLタグは使えません。

 

[Tag]前後の記事

« Movable Type 設置&カスタマイズ   カテゴリー内の前後のエントリーへのナビ(PHP) »

XREAAD