Hi Jani
this is the code that reproduces the bug. I've posted it to the bug db
This is a PHP POP3 Socket Test that demonstrates a Windows PHP CGI bug
which consumes the transfered data thru the socket 
and never releases them. Each round of the for cycle below gets slower
and slower and never finishes the end.
To test it edit the POP3 server variables below. Make sure there's only
one 500K message in the POP3 mailbox.
Then run the test. Currently the PHP gives up in the 11th cycle. On
windows 9x the PHP stops running. On windows
NT/2000 the PHP goes crazy, consumes 100% CPU and never finishes.

Please, contact me:
Jakub Klos

PHP POP3 Socket Test<BR><BR>

  $server = "localhost";
  $port = 110;
  $user = "user";
  $pass = "pass";
  $round = 20;
  // connect to the POP3 server and read the response
        $socket = fsockopen($server, $port);
        $line = fgets($socket, 1024);
  // USER and PASS commands
        fputs($socket, "USER $user\r\n");
        $line = fgets($socket, 1024);
        fputs($socket, "PASS $pass\r\n");
        $line = fgets($socket, 1024);
  $length = 0;
  for ($i = 1; $i < $round + 1; $i++)
    // RETR command to receive the message
        fputs($socket, "RETR 1\r\n");
    $line = fgets($socket, 1024);
    if ($line[0] == "-") break;
    while (($line = fgets($socket, 1024)) <> ".\r\n")
      if (!($line)) break;
      $length += strlen($line);

    echo "Round $i/$round, Transfered $length<BR>";
  echo "Total bytes received: $length";
> ID: 10092
> Updated by: sniper
> Reported By: [EMAIL PROTECTED]
> Old-Status: Open
> Status: Feedback
> Bug Type: Sockets related
> Assigned To:
> Comments:
> Please add a self containing short script into this report
> which can be used to reproduce this problem.
> --Jani
> Previous Comments:
> ---------------------------------------------------------------------------
> [2001-03-31 09:56:39] [EMAIL PROTECTED]
> When using the fgets function for large data transmission the data transmitted are 
>never freed from memory. When using fgets with files it works fine. The PHP CGI 
>module starts to utilize the CPU to 100% and never ends, stops processing and doesn't 
>exit the fgets function after few read cycles. This happens only on Windows PHP CGI. 
>We tested Apache and that worked fine. Even the previous version of PHP did that. 
>Large data I'm talking about is 8MB and above.
> ---------------------------------------------------------------------------
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at http://bugs.php.net/?id=10092&edit=2

IceWarp Software
Web: http://www.icewarp.com
Fax: +1(240)5254912
ICQ: 1255673

PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to