ID:               40147
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bnewton at networkmerchants dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: LINUX
 PHP Version:      Irrelevant
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.


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

[2007-01-16 17:53:18] bnewton at networkmerchants dot com

Description:
------------
The first example on the Sockets section of the manual uses socket_bind
and socket_listen incorrectly. They manual page for each function
correctly states that they return BOOLEAN values, not error return
codes. That means the lines:

if (($ret = socket_bind($sock, $address, $port)) < 0) {
   echo "socket_bind() failed: reason: " . socket_strerror($ret) .
"\n";
}

if (($ret = socket_listen($sock, 5)) < 0) {
   echo "socket_listen() failed: reason: " . socket_strerror($ret) .
"\n";
}

Will not fail, if there is an error. If they did fail, they would not
report any meaningful error message (error 0 ie false is "success"). 



Reproduce code:
---------------
if (($ret = socket_bind($sock, $address, $port)) < 0) {
   echo "socket_bind() failed: reason: " . socket_strerror($ret) .
"\n";
}

if (($ret = socket_listen($sock, 5)) < 0) {
   echo "socket_listen() failed: reason: " . socket_strerror($ret) .
"\n";
}

Expected result:
----------------
If the socket is not available it should stop the execution of the
script and display a meaningful error message. 

Actual result:
--------------
It will continue to run the code below, even if there really was an
error. If it did stop, it would not print the correct error message


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


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

Reply via email to