note 90343 deleted from function.socket-accept by cataphract
| From: | cataphract@php.net | Date: | Sat, 03 Sep 2011 18:28:51 +0000 |
| Subject: | note 90343 deleted from function.socket-accept by cataphract | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182930@lists.php.net to get a copy of this message | ||
Note Submitter: alan at binarystars dot com
----
Beware 'socket_accept' does not return false; instead it returns NULL on error:
<?php
# accept the client and create a new socket
if (($new_socket = @socket_accept($master_socket))===false) {
echo "I should be here; but I'm not.";
}
var_dump($master_socket);
var_dump($new_socket);
?>
==================
CLI OUTPUT:
array(1) {
[0]=>
resource(20) of type (Socket)
}
NULL
==================
Where $master_socket should be a single resource.