Re: [PHP-DEV] Tracing exit()

2016-08-05 Thread Christoph Becker
On 05.08.2016 at 01:37, Sara Golemon wrote: > On Thu, Aug 4, 2016 at 11:10 AM, Bishop Bettini wrote: > >> Or, alternatively, I wonder if a method to convert an exit to an exception >> would be better: > > Eh... That feels less-obvious to me for the reasons you stated in your >

Re: [PHP-DEV] Tracing exit()

2016-08-04 Thread Thomas Bley
Hi! having a complete trace from an exception would be great: function shutdown() { $e = new Exception(); echo $e->getTraceAsString(); } function test() { exit; } register_shutdown_function('shutdown'); test(); gives: #0 [internal function]: shutdown() #1 {main} Regards Thomas Bishop

Re: [PHP-DEV] Tracing exit()

2016-08-04 Thread Sara Golemon
On Thu, Aug 4, 2016 at 11:10 AM, Bishop Bettini wrote: > I'm wondering if the shutdown functions could access telemetry: > > register_shutdown_function(function () { > > $context = shutdown_get_context(); > > /** array ( 'exit' => array ('file' => '/path/to/Foo.php',

Re: [PHP-DEV] Tracing exit()

2016-08-04 Thread Dan Ackroyd
Hi Bishop, It would be good to preserve contexts to make debugging easier. > I wonder if a method to convert an exit to an exception > would be better: That doesn't sound like a good plan. There are times when exiting almost straight away is the correct thing to do. If we changed exit() to not

Re: [PHP-DEV] Tracing exit()

2016-08-04 Thread David Walker
On Thu, Aug 4, 2016 at 12:11 PM Bishop Bettini wrote: > Hi! > > exit (and its doppelganger die) is a hard stop to the engine and there is > little telemetry provided about the circumstances (file, line, message, and > code). In source I control, exit is no big deal: I don't use

[PHP-DEV] Tracing exit()

2016-08-04 Thread Bishop Bettini
Hi! exit (and its doppelganger die) is a hard stop to the engine and there is little telemetry provided about the circumstances (file, line, message, and code). In source I control, exit is no big deal: I don't use exit! But in library code, exit can be frustrating. register_shutdown_function +