|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: alberty at neptunelabs dot de
New email:
PHP Version: OS:


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

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:

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://", 33334, $errno, $errstr);
if (!$fp) {
    echo "ERROR: $errno - $errstr<br>\n";
else {
    $content=fread($fp, 40);
    echo "<hr>read length: ".strlen($content)."<hr>";
    echo $content."<hr>";
    echo bin2hex($content)."<hr>";
echo "Finished @ ".time();

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




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-28 10:01 UTC]
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]
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-2022 The PHP Group
All rights reserved.
Last updated: Thu Oct 06 21:05:56 2022 UTC