Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Install Warning: Check that the php.ini setting allow_call_time_pass_reference is on


Reply

3 Posts   2256 Views

Avatar
HiltonT

2 November 2008 at 1:15pm (Last edited: 2 November 2008 1:15pm), Community Member, 2 Posts

During installation of Silverstripe 2.2.3, I received the following warning:

Check that the php.ini setting allow_call_time_pass_reference is on

allow_call_time_pass_reference is set to '' in php.ini. You can install with allow_call_time_pass_reference not set, but some warnings may get displayed. For best results, turn it on.

Interestingly, this is the information from php.net about this directive...

allow_call_time_pass_reference boolean
Whether to warn when arguments are passed by reference at function call time. This method is deprecated and is likely to be unsupported in future versions of PHP/Zend. The encouraged method of specifying which arguments should be passed by reference is in the function declaration. You're encouraged to try and turn this option Off and make sure your scripts work properly with it in order to ensure they will work with future versions of the language (you will receive a warning each time you use this feature).

Passing arguments by reference at function call time was deprecated for code cleanliness reason. Function can modify its argument in undocumented way if it didn't declared that the argument is passed by reference. To prevent side-effects it's better to specify which arguments are passed by reference in function declaration only.

So, it appears that the php developers recommend against the use of this directive as it is deprecated, however Silverstripe uses it. What's the likelihood that when this directive is unsupported (for reasons of code cleanliness), Silverstripe will have issues?

I'm *very* surprised that I saw this warning during the installation of Silverstripe - this directive was deprecated because it wasn't a good way to pass arguments to a function, a much better way is (as mentioned in the php team response) to pass them by reference in a function declaration.

Avatar
Willr

3 November 2008 at 6:09pm Forum Moderator, 5511 Posts

Its unlikely SS will break with this off. I've had it off for a long time and never encounted any issues with it being off. The warning is only there I guess as a note for the user so they are aware of it

Avatar
HiltonT

3 November 2008 at 7:56pm Community Member, 2 Posts

... any chance the code will be updated so that a) this isn't necessary and b) the warning isn't necessary? It seems that coding using this method of passing variables is far from recommended practice.