ID:              35449
 User updated by: profic at kursknet dot ru
 Reported By:     profic at kursknet dot ru
-Status:          Feedback
+Status:          Open
 Bug Type:        Documentation problem
 PHP Version:     Irrelevant
 New Comment:

Hm. I didn't suppose, that documentashion problem needs test case. Here
is one:
<?php
$s = stream_socket_client('tcp://localhost:80', $errno, $error, 5);
stream_socket_sendto($s, "GET http://localhost/ HTTP/1.0\r\n");
stream_socket_sendto($s, "Host: localhost\r\n");
stream_socket_sendto($s, "\r\n");

echo "stream_get_line():\n";
var_dump(stream_get_line($s, 1500, "\r\n"));
echo "stream_socket_recvfrom():\n";
var_dump(stream_socket_recvfrom($s, 100));
echo "stream_get_contents():\n";
var_dump(stream_get_contents($s, 100));
?>

Output of it for my system is:
stream_get_line():
string(15) "HTTP/1.1 200 OK"
stream_socket_recvfrom():
bool(false)
stream_get_contents():
string(100) "Date: Sat, 03 Dec 2005 14:32:05 GMT
Server: Apache/2.0.54 (Win32) PHP/5.1.0RC5-dev
Content-Length:"

As you can see stream_socket_recvfrom() returns false the same as when
"end of socket" is reached. And it is reached. All incoming data from
socket is stored in stream buffer, call to stream_get_contents() proves
that.


Previous Comments:
------------------------------------------------------------------------

[2005-11-29 14:26:30] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2005-11-28 15:30:49] profic at kursknet dot ru

Description:
------------
Calls to stream_socket_recvfrom() on socket-based streams, after calls
to buffer-based stream funcions (like fread(), steam_get_line()) may
lead to unexpected (to user) results as it is bypass stream buffer.
Thus is seems to be a good idea to have warning/note in documentation
of stream_socket_recvfrom() about this. Elsewise it can be runtime
notice in case of use stream_socket_recvfrom() on stream with non-empty
buffer.




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35449&edit=1

Reply via email to