note 115568 added to function.stream-socket-client

From: Date: Mon, 18 Aug 2014 12:22:00 +0000
Subject: note 115568 added to function.stream-socket-client
Groups: php.notes 
Request: Send a blank email to php-notes+get-200210@lists.php.net to get a copy of this message
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 ?> ---- Server IP: 72.52.91.14 Probable Submitter: 194.77.141.161 ---- Manual Page -- http://php.net/manual/en/function.stream-socket-client.php Edit -- https://master.php.net/note/edit/115568 Del: integrated -- https://master.php.net/note/delete/115568/integrated Del: useless -- https://master.php.net/note/delete/115568/useless Del: bad code -- https://master.php.net/note/delete/115568/bad+code Del: spam -- https://master.php.net/note/delete/115568/spam Del: non-english -- https://master.php.net/note/delete/115568/non-english Del: in docs -- https://master.php.net/note/delete/115568/in+docs Del: other reasons-- https://master.php.net/note/delete/115568 Reject -- https://master.php.net/note/reject/115568 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200210) next »