# [PATCH] - Check configured error level before reporting E_NOTICE messages

- Thread: https://externals.io/message/45914
- Original archive: https://news-web.php.net/php.internals/45914
- Started by Arvind Srinivasan on 2009-10-30T12:39:22+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #45914 — Arvind Srinivasan — 2009-10-30T12:39:22+00:00

URL: https://externals.io/message/45914#45914

When compiled with #ifdef ZTS, zend_error invokes pthread_get_specific.

The performance analyzer tool indicated that zend_error was being
invoked during normal processing of requests, even though no error
messages were logged. The source of these calls were `E_NOTICE` 
messages.

Please review the attached patch which introduces a REPORT_ERROR macro
to avoid invoking the zend_error function when the error reporting
level indicates that `E_NOTICE` messages are not to be reported.
Although, all these codepaths are not executed, I guarded all `E_NOTICE` 
messages using the REPORT_ERROR macro.

thanks,
arvi

---

## #45916 — Derick Rethans — 2009-10-30T14:18:51+00:00

URL: https://externals.io/message/45914#45916 · In reply to: #45914

> When compiled with #ifdef ZTS, zend_error invokes pthread_get_specific.
> 
> The performance analyzer tool indicated that zend_error was being
> invoked during normal processing of requests, even though no error
> messages were logged. The source of these calls were `E_NOTICE` 
> messages.
> 
> Please review the attached patch which introduces a REPORT_ERROR macro
> to avoid invoking the zend_error function when the error reporting
> level indicates that `E_NOTICE` messages are not to be reported.
> Although, all these codepaths are not executed, I guarded all `E_NOTICE` 
> messages using the REPORT_ERROR macro.

This is a bad idea, because the error handler does other things as well. 
This is quite a bit of a BC break.

regards,
Derick

-- 
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org
twitter: @derickr

---

## #45919 — Arvind Srinivasan — 2009-10-31T09:48:21+00:00

URL: https://externals.io/message/45914#45919 · In reply to: #45916

> This is a bad idea, because the error handler does other things as well.

If the error reporting level indicates that the user is not interested
in E_FOO, why would there be an expectation that zend_error be invoked
for E_FOO messages?

Arvi

---

## #45920 — Alexey Zakhlestin — 2009-10-31T10:08:48+00:00

URL: https://externals.io/message/45914#45920 · In reply to: #45919

> > […]
>
> If the error reporting level indicates that the user is not interested
> in E_FOO, why would there be an expectation that zend_error be invoked
> for E_FOO messages?

error_reporting setting is related to automatic reactions on errors  
only.
but php provides additional means to get last-error manually which  
should work without relation to this setting
