[PHP-DEV] [Disccusion] Introduce error_clear_last() function

2015-03-03 Thread reeze
Hi internals,

I would like to implement FR #45235. below copied from Github.

What do you think about it?

-
You can view the Pull Request on github:
https://github.com/php/php-src/pull/1135

Pull Request Description:
In PHP a simple assign expression would raise error, if user use
error_get_last() to check they can't guarantee the call site raise the
error.

This patch implement a function to clear the error state.


http://php.net/error_get_last
The top voted user contributed note are a tricky way to clear last error.

also there are a lot of apps use the similar hacks.

1.
https://github.com/mathnerd3141/doeqs_new/blob/ba23c478a0c819dc6b2f8f96f9df35d16505eed2/errors.php#L20
2.
https://github.com/benfinke/cargo_plane/blob/4911bc6a91d8345aa62c81fb52c8bed9d216c44e/Splunk/Util.php#L89

Request: https://bugs.php.net/bug.php?id=45235

-- 
Reeze Xia
http://reeze.cn


Re: [PHP-DEV] [Disccusion] Introduce error_clear_last() function

2015-03-03 Thread Julien Pauli
On Tue, Mar 3, 2015 at 11:13 AM, reeze re...@php.net wrote:

 Hi internals,

 I would like to implement FR #45235. below copied from Github.

 What do you think about it?


I had the same idea and I even got a patch somewhere.
I'm +1 and should merge your idea soon, if nobody rejects the idea.

PS : we could benefit from this move to refactor error management as well,
Nikic's got an RFC about exceptions in the engine as well.

Julien.Pauli