Forum Moderators: coopster

Message Too Old, No Replies

fsockopen() error/pass-by-reference deprecated - error

upgraded php & mysql, now searching for INI file to fix this error.

         

ikbenhet1

3:25 pm on Jan 2, 2004 (gmt 0)

10+ Year Member



error after php & mysql upgrade, worked fine before,The 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/.sites/28/site1/web/file.php on line 1260

Question:

What INI file do they mean?
Can i create a new INI file in the root?
What's the name of this INI file?

Is it easier to modify the fsockopen declaration? if so how is that to be done?

This is on a dedicated server.

<added> line 1260: $connection = fsockopen($host , 80, &$errorNumber, &$errorString, 10);
</added>
Thank you very much.

Glacai

4:02 pm on Jan 2, 2004 (gmt 0)

10+ Year Member



I could be wrong but the & creates a call by reference so maybe try removing these to pass by value.

ikbenhet1

4:13 pm on Jan 2, 2004 (gmt 0)

10+ Year Member




You are right. i don't even use those strings, cut 'n paste errors. thanks.

coopster

4:20 pm on Jan 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



For future reference, the ini file mentioned is the PHP Runtime Configuration [php.net] file. Also, there is a note in the fsockopen [php.net] manual that states:

Note that the errno and errstr arguments will always be passed by reference.

jatar_k

5:09 pm on Jan 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it is a common error when using functions

a function call as such will cause the error
$var = myfunction($var1,$var2,&$var3);

given that passing by reference is a no go. So we do it the other way around

function myfunction($var1,$var2,&$var3) {

and then the function call
$var = myfunction($var1,$var2,$var3);

I do it every once in a while and it takes a minute to remember what I have done wrong. Just thought I would mention it though it doesn't specifically apply here. ;)