[PHP-users 33702] 参照渡しについて

kaz okui @ sannet.ne.jp
2008年 6月 25日 (水) 00:25:03 JST


こんにちは 奥井です。
classの関数への変数を参照渡しにして動作はしたんですが/var/log/apache2/error_logをみたらWarningがでていました。
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 [runtime function name]().  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.

マニュアルをみたら「推奨される方法は、関数宣言時に参照渡しとするべき引数を指定する」とありますがこれはどうやるんでしょうか?
それからphp.iniでallow_call_time_pass_referenceをOn/OffどちらでもPHP Warningはでるのは正しいのでしょうか?
それに関数コール時に参照で引数を渡すことはやめたほうがいいというような事が書かれていますがphp5からは参照渡しが標準になったということを考えるとなんだかよくわかりません。ご教授お願いします。

使用しているphpは4.4.8です。
$new_rec_timeを参照渡しにして関数check_overlap内で$new_rec_timeを変更して呼出側で$new_rec_timeを使っています。こういう方法はよくないのでしょうか?
$id = $c->overlap->check_overlap($c,$kind,"","",&$new_rec_time);


PHP-users メーリングリストの案内