From:
Operating system: CentOS 5.5
PHP version: Irrelevant
Package: Sockets related
Bug Type: Bug
Bug description:I have PHP >5 and have a call-time pass-by-reference problem
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 bug report at http://bugs.php.net/bug.php?id=53135&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53135&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53135&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53135&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53135&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53135&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53135&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53135&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53135&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53135&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53135&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53135&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53135&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53135&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53135&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53135&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53135&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53135&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53135&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53135&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53135&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53135&r=mysqlcfg