Call-time pass-by-reference has been deprecated

apps

#1

Hi. I’m trying to install DeltaScripts’ PHPClassifieds script.
http://www.deltascripts.com/phpclassifieds

I had to create a new subdomain for it since my main domain is on PHP4 and I couldn’t turn register_globals off. The subdomain where I’m trying to install this script is running on PHP5. (Read on another thread that register_globals can be turned off on PHP5 or something.) With PHP4, the installer would run and tell me that register_globals needed to be off and that would be the end of it. With PHP5, I’m getting the following error:

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 fsockopen(). 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 /home/.abdon/user/sub.domain.com/functions.php on line 2345

Line 2345 of functions.php says:
$fp = fsockopen($host, $port, &$errno, &$errstr, 4 );

Any ideas on how I can fix this?

I’ve tried taking out the & in the code but that didn’t help. The warning thing didn’t show up but the page didn’t load fully. Or rather, it did, but only the top portion shows up.


#2

Take off the ‘&’ from in front of the variables and that will fix it.

Change from PHP4 to PHP5: Objects are, by default, passed by reference. Hence the “deprecated” error you got.

Then there’s something else wrong. Try turning on errors to E_ALL or E_STRICT.


yerba# rm -rf /etc
yerba#


#3

What is that and how do I do it?


#4

http://us2.php.net/manual/en/function.error-reporting.php

They are levels of PHP error reporting.


yerba# rm -rf /etc
yerba#


#5

Sorry for sounding so inexperienced (maybe because I am), but how would I go about turning those error things on? Thanks.


#6

So um, is there any way DH can turn on call-time pass reference?

It would be nice if DH allowed users to change certain PHP settings using .htaccess or something. =(


#7

No. Two reasons: (1) it’s a change in the /language/ that’s causing the problem (not merely a config setting – setting was added for backwards compatibility); (2) setting will no longer be an option in PHP6 (hence the comment However, future versions may not support this any longer).

The only logical course of action is to update the scripts. If you’re having problems, contact the original author.

It’s just a function, as the page stated. Add error_reporting(E_ALL) or error_reporting(E_STRICT) anywhere at the very top/first page of your script.

yerba# rm -rf /etc
yerba#