note 115568 deleted from function.stream-socket-client by salathe
| From: | salathe@php.net | Date: | Fri, 22 Aug 2014 08:14:25 +0000 |
| Subject: | note 115568 deleted from function.stream-socket-client by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200275@lists.php.net to get a copy of this message | ||
Note Submitter: info at stephan-schulze dot de
----
I find it worth mentioning, that a WARNING is always thrown when the connection fails for some
reason.
This can especially be annoying in development when you want to handle connection problems.
The only solution I found is, to disable the warnings before the function call and resetting them
directly afterwards like this:
<?php
$oldErrorReporting = error_reporting(); // save error reporting level
error_reporting($oldErrorReporting ^ E_WARNING); // disable warnings
$fp = stream_socket_client($connectionString...);
error_reporting($oldErrorReporting); // restore error reporting level
?>