Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-29 Thread Yasuo Ohgaki
Hi Thomas, On Thu, Jan 29, 2015 at 4:55 PM, Thomas Bley wrote: > I think you mean: > function myErrorHandler( int $errno , string $errstr [, string $errfile [, > int $errline [, array $errcontext [, string &$extra_errstr ) > Yes. > > We have these empty-call-filled-on-return parameters i

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Thomas Bley
I think you mean: function myErrorHandler( int $errno , string $errstr [, string $errfile [, int $errline [, array $errcontext [, string &$extra_errstr ) We have these empty-call-filled-on-return parameters in preg_match(...$match) but I am not sure if it makes things more complicated than

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Thomas Bley
> User defined error handler is for error handling customization, letting > user > customize message makes sense. This is exactly our case. > Thomas, > If there are many people concerns to change error message, how about > append user error message to original error message when it's changed? > I

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Yasuo Ohgaki
Hi Andrea, On Thu, Jan 29, 2015 at 2:38 AM, Andrea Faulds wrote: > Error handlers are global anyway, so this is useless (or dangerous) for > libraries. I suggest library/framework developers *not* to use user defined error handler. It's better to leave error handler for application developers.

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Yasuo Ohgaki
Hi Thomas, On Thu, Jan 29, 2015 at 11:51 AM, Yasuo Ohgaki wrote: > If there are many people concerns to change error message, how about > append user error message to original error message when it's changed? > How about this signature. function myErrorHandler($errno, $errstr, $errfile, $errli

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Thomas Bley
>> Error handlers are global anyway, so this is useless (or dangerous) for >> libraries. I'm not sure if there is a library that parses php errors and is not able to handle prefixes or suffixes. I'm using a similar workaround for many years now in code bases with 500k+ lines of code and it was n

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Thomas Bley
> Error handlers are global anyway, so this is useless (or dangerous) for > libraries. Yes that's true, maybe set_error_handler can be changed so it behaves like register_shutdown_function or spl_autoload_register when multiple callbacks are registered? Regards Thomas Andrea Faulds wrote on 2

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Andrea Faulds
Hi Thomas, > On 28 Jan 2015, at 17:36, Thomas Bley wrote: > > the idea behind the rfc is not to change error messages, it's only to append > useful information to them. That’s still changing the message. Error handlers are global anyway, so this is useless (or dangerous) for libraries. I do

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Thomas Bley
Hi, the idea behind the rfc is not to change error messages, it's only to append useful information to them. Regards Thomas Andrea Faulds wrote on 28.01.2015 17:53: > Hi Thomas, > >> On 27 Jan 2015, at 02:45, Thomas Bley wrote: >> >> Here is the rfc: >> https://wiki.php.net/rfc/error_handle

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-28 Thread Andrea Faulds
Hi Thomas, > On 27 Jan 2015, at 02:45, Thomas Bley wrote: > > Here is the rfc: > https://wiki.php.net/rfc/error_handler_callback_parameters_passed_by_reference > > Thanks to reeze for coding and putting it on the wiki. > > Regards > Thomas This feels rather weird and “hacky” to me. Error hand

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Yasuo Ohgaki
Hi Xinchen, On Wed, Jan 28, 2015 at 3:15 PM, Xinchen Hui wrote: > actually, this should already be in access.log(the last 500 error > one).. I don't see why you need it in error log > PHP log would be more useful with user ID/name to identify who was trying to tamper with system, for e

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Thomas Bley
>> Request-Uri: /custom/foobar >> Request-Params: {"action":"edit"} > actually, this should already be in access.log(the last 500 error > one).. I don't see why you need it in error log Sorry, my example is not precise enough. Normally, $_POST, $_SESSION['username'] and php://input a

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Xinchen Hui
On Wed, Jan 28, 2015 at 2:11 PM, Thomas Bley wrote: > There are some workarounds with register_shutdown_function to extend E_ERROR > messages, but I think that's quite dirty in a system with many parallel > requests. > Here is an example: > > ini_set('error_reporting', E_ALL); > ini_set('displa

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Thomas Bley
There are some workarounds with register_shutdown_function to extend E_ERROR messages, but I think that's quite dirty in a system with many parallel requests. Here is an example: 'edit'); function check_for_fatal() { $error = error_get_last(); if ($error['type'] == E_ERROR) { $errstr =

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Thomas Bley
Hi, the idea behind the rfc is not to change error messages, it's only to append useful information to them. Changing lines/filenames is surely something controversial and might be only useful when compiling configuration files or templates to php code. Therefore we have 3 options in the voting

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Stanislav Malyshev
Hi! > I feel it's kindof wrong direction. > > if you want custom logs, maybe you should use custom logger. Same here, API basing on modifying something that is supposed to be internal engine things feels wrong, even if it does work. Changing error message is borderline, changing things like line

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Yasuo Ohgaki
Hi all, On Wed, Jan 28, 2015 at 3:09 AM, Yasuo Ohgaki wrote: > On Tue, Jan 27, 2015 at 9:26 PM, Xinchen Hui wrote: > >> if you want custom logs, maybe you should use custom logger. > > > It requires to catch all errors, I suppose. If PHP allows it, either would > work. I considered a little m

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Yasuo Ohgaki
Hi Xinhcen, On Tue, Jan 27, 2015 at 9:26 PM, Xinchen Hui wrote: > if you want custom logs, maybe you should use custom logger. It requires to catch all errors, I suppose. If PHP allows it, either would work. Regards, -- Yasuo Ohgaki yohg...@ohgaki.net

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-27 Thread Xinchen Hui
Hey: On Tue, Jan 27, 2015 at 11:08 AM, Yasuo Ohgaki wrote: > Hi Thomas, > > On Tue, Jan 27, 2015 at 11:45 AM, Thomas Bley wrote: > >> Here is the rfc: >> >> https://wiki.php.net/rfc/error_handler_callback_parameters_passed_by_reference >> >> Thanks to reeze for coding and putting it on the wiki.

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-26 Thread Yasuo Ohgaki
Hi Thomas, On Tue, Jan 27, 2015 at 11:45 AM, Thomas Bley wrote: > Here is the rfc: > > https://wiki.php.net/rfc/error_handler_callback_parameters_passed_by_reference > > Thanks to reeze for coding and putting it on the wiki. > It looks good to me. Future Scope set_error_handler() callback migh

Re: [PHP-DEV][RFC] Enable error_handler callback parameters to be passed by reference

2015-01-26 Thread Thomas Bley
Here is the rfc: https://wiki.php.net/rfc/error_handler_callback_parameters_passed_by_reference Thanks to reeze for coding and putting it on the wiki. Regards Thomas reeze wrote on 23.01.2015 10:59: > Yeah, seem other want it it too, so I just updated the PR to allow the first > four paramete