Hi Bishop,

> On Dec 31, 2015, at 3:48 PM, Bishop Bettini <bis...@php.net> wrote:
> 
> I am -1 on removing @ for 7.x series.  But, I would be in favor of all
> changes that remove unnecessary error messages or add functionality to
> better work with error messages. In my mind, those are requisite steps
> before removing @.
> 

I am also very much in agreement with this. There are many conditions where a 
warning or other error is raised with no way to test for the condition that 
will trigger the error. Before the @ can be removed, either these errors need 
to be removed or they need to become an exception that can be caught. For 
example, I have the following code for writing to a non-blocking stream (assume 
$resource is a stream socket resource and $data is a string):

// Error reporting suppressed since fwrite() emits E_WARNING if the pipe is 
broken or the buffer is full.
$written = @fwrite($resource, $data);
if (false === $written) {
    $message = 'Failed to write to stream.';
    if ($error = error_get_last()) {
        $message .= sprintf(' Errno: %d; %s', $error['type'], 
$error['message']);
    }
    throw new FailureException($message);
}

There is no way of knowing if the stream buffer is full before calling 
fwrite(), resulting in a warning and 0 being returned. IMO, just 0 should be 
returned without issuing a warning.

Aaron Piotrowski
https://trowski.com
@trowski2002


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to