php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20134 read from UDP results wrong data
Submitted: 2002-10-28 08:38 UTC Modified: 2002-11-14 01:47 UTC
From: alberty at neptunelabs dot de Assigned:
Status: No Feedback Package: Sockets related
PHP Version: 4CVS-2002-10-28 OS: i686-pc-linux-gnu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-10-28 08:38 UTC] alberty at neptunelabs dot de
Hi,

If you open an UDP connection to a non open udp port
with fsockopen, fread reads the requested length, but
the content is sometimes wrong (nonsensical data)

This short script demonstrate the problem:

<?php
header ('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, no-risk, no-fun');
header ('Pragma: no-cache');

// Please replace the ip address with an existing host
$fp = fsockopen("udp://192.168.0.1", 33334, $errno, $errstr);
if (!$fp) {
    echo "ERROR: $errno - $errstr<br>\n";
}
else {
    fwrite($fp,"\n");
    $content=fread($fp, 40);
    echo "<hr>read length: ".strlen($content)."<hr>";
    echo $content."<hr>";
    echo bin2hex($content)."<hr>";
    fclose($fp);
}
echo "Finished @ ".time();
?>

I've test it with the lastest cvs version (28.10.2002)

Regards,

Steve

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-28 10:01 UTC] wez@php.net
Did it do this with PHP 4.2.3?

Also, your test script is not very useful to us because:
a) We don't have some unknown UDP service on 33334
b) We don't know what data it sends
c) We don't know what data the script receives and thus
   how it is wrong.

Please supply us with more information, and we'll be happy
to resolve the problem.
 [2002-11-14 01:47 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 08:03:35 2021 UTC