Edit report at http://bugs.php.net/bug.php?id=53135&edit=1

 ID:                 53135
 Updated by:         [email protected]
 Reported by:        josh dot richard at gmail dot com
 Summary:            I have PHP >5 and have a call-time pass-by-reference
                     problem
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Sockets related
 Operating System:   CentOS 5.5
 PHP Version:        Irrelevant
 Block user comment: N

 New Comment:

You shouldn't specify &$errno and &$errstr with the & operator;

simply providing $errno and $errstr will work fine.



Further explanation: http://php.net/language.references.pass



Not a bug; closing.


Previous Comments:
------------------------------------------------------------------------
[2010-10-22 10:23:10] josh dot richard at gmail dot com

Description:
------------
I'm trying to use fsocketopen() to test a server connection- to see if
it's online or offline.



Even the manual says I can call it like this:



$connection = fsockopen("www.example.com", 80, $errno, $errstr, 30);





However, I get this warning message when doing so:



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 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. 





Is there another way to declare fsocketopen()??? I see nothing about
this!!

Test script:
---------------
<?

// This value is either example.com OR example.com:port

$serverAddress = $_POST[server];



@list($addr,$port)= explode (':', $serverAddress);

if (empty($port)) {

$port = 80;

}

// Test the server connection

$connection = @fsockopen($addr, $port, &$errno, &$errstr, 30);

        if (!$connection) {

        echo $addr . ":" . $port . " is currently DOWN";

        } else {

        echo $addr . ":" . $port . " is currently UP";

        }

?>

Expected result:
----------------
Not expecting any warning!!

Actual result:
--------------
Where does this warning come from? I've called fsocketopen() like this
for years!!


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53135&edit=1

Reply via email to