title: How to obtain error for functions stream_get_line and fgets?
body: <p>I have a code where I open a socket connection. From time to time it happens that <a href="http://php.net/manual/en/function.fgets.php" rel="nofollow">fgets</a> returns false. I would like to find out why it happens. Is there a function that would provide more details about last error on <code>$handle</code>? Something like <code>preg_last_error</code>, <code>json_last_error</code>, …</p>
  
  <p>The same question can be applied to function <a href="http://php.net/manual/en/function.stream-get-line.php" rel="nofollow">stream_get_line()</a>.</p>
  
  <p>I use PHP 5.4 and <code>E_ALL</code> is in error_reporting (i.e. it includes even <code>E_NOTICE</code>). No error was thrown.</p>