From: mk75 at sky dot ru
Operating system: Windows XP SP2
PHP version: 5.2.6
PHP Bug Type: Streams related
Bug description: Bug with opening udp socket on localhost
Description:
------------
Hello. I opening udp socket on my ip adress on closed port and fsock open
don't return error, but when i trying make fread after fwrite i've got
error reading socket.
Reproduce code:
---------------
function STAT_PACKET()
{
$packet = pack("H*","FFFFFFFF");
$packet .= "TSource Engine Query";
$packet .= pack("H*","00");
return $packet;
}
if (!$socket=fsockopen("udp://127.0.0.1",324,$errno,$errstr,2))
{
die("Error opening socket: $errstr<br>Code of error: $errno");
}
fwrite ($socket,STAT_PACKET());
if (!$buff=fread ($socket,1000)){echo "Error reading socket";return
false;} ;
$buffer = trim(substr($buff, 4));
if (!trim($buffer)) { echo "error";return false; }
fclose($socket);
Expected result:
----------------
Code print Error reading socket and return false then exit.
--
Edit bug report at http://bugs.php.net/?id=45329&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45329&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45329&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45329&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45329&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45329&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45329&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45329&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45329&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45329&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45329&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45329&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45329&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45329&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45329&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45329&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45329&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45329&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45329&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45329&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45329&r=mysqlcfg