Re: [PHP-DEV] exit() via exception

2020-03-15 Thread Manuel Canga
En mié, 11 mar 2020 11:09:13 +0100 Nikita Popov escribió > On Fri, Oct 11, 2019 at 4:11 PM Nikita Popov wrote: > > > On Fri, Oct 11, 2019 at 3:47 PM Marcio Almada > > wrote: > > > >> Em sex, 11 de out de 2019 às 08:05, Nikita Popov > >> escreveu: > >> > > >> > Hi, >

Re: [PHP-DEV] exit() via exception

2020-03-11 Thread Nikita Popov
On Fri, Oct 11, 2019 at 4:11 PM Nikita Popov wrote: > On Fri, Oct 11, 2019 at 3:47 PM Marcio Almada > wrote: > >> Em sex, 11 de out de 2019 às 08:05, Nikita Popov >> escreveu: >> > >> > Hi, >> > >> >> Hello :) >> >> > Currently exit() is implemented using bailout and unclean shutdown, >> which

Re: [PHP-DEV] exit() via exception

2019-10-13 Thread Thomas Lamy
Am 11.10.19 um 15:16 schrieb Claude Pache: Le 11 oct. 2019 à 13:05, Nikita Popov a écrit : I'm mainly wondering how exactly we'd go about integrating this in the existing exception hierarchy. Assuming that it is desirable to allow people to actually catch this exception, my first thought woul

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Stanislav Malyshev
Hi! > For me, one of the most annoying things about this is that we can't perform > proper leak checks on code using PhpUnit, because it will always exit() at > the end, which will result in "expected" memory leaks. Is that something that might be fixed in phpunit? I am not familiar with this spe

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Olumide Samson
I'm thinking exit() shouldn't be catchable to maintain status quo, and it should be focused on the reason it was suggested(Unwinding stacks and cleaning up memories instead of longjmp'ing to shutdown). If there's any need to catch it's exception, that can be handled later through maybe a RFC discu

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Bishop Bettini
On Fri, Oct 11, 2019 at 10:11 AM Nikita Popov wrote: > On Fri, Oct 11, 2019 at 3:47 PM Marcio Almada > wrote: > > > Em sex, 11 de out de 2019 às 08:05, Nikita Popov > > escreveu: > > > > > Currently exit() is implemented using bailout and unclean shutdown, > which > > > means that we're going t

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Aaron Piotrowski
> On Oct 11, 2019, at 10:21 AM, Nikita Popov > wrote: > >> Hi! >> >> So maybe it narrows down to: >> >> Is there an essencial attempt to improve `exit()` handling from the >> userland perspective or should the focus be solely on solving the >> memory management iss

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Bruce Weirdan
On Fri, Oct 11, 2019 at 2:43 PM Andreas Hennings wrote: > What other use cases exist for exit()? Setting exit code for cli scripts. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Nikita Popov
On Fri, Oct 11, 2019 at 5:13 PM Marcio Almada wrote: > Hi! > > > > I don't believe atexit applies to os._exit(). In any case, I agree that > > > this is something we're currently missing -- we should probably add a > > > pcntl_exit() for this purpose. It should be noted though that this is > > >

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Marcio Almada
Hi! > > I don't believe atexit applies to os._exit(). In any case, I agree that > > this is something we're currently missing -- we should probably add a > > pcntl_exit() for this purpose. It should be noted though that this is > > really very different from exit(), which is still quite graceful a

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Aaron Piotrowski
> On Oct 11, 2019, at 9:11 AM, Nikita Popov wrote: > > On Fri, Oct 11, 2019 at 3:47 PM Marcio Almada wrote: > >> Em sex, 11 de out de 2019 às 08:05, Nikita Popov >> escreveu: >>> >>> Hi, >>> >> >> Hello :) >> >>> Currently exit() is implemented using bailout and unclean shutdown, which

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Nikita Popov
On Fri, Oct 11, 2019 at 3:47 PM Marcio Almada wrote: > Em sex, 11 de out de 2019 às 08:05, Nikita Popov > escreveu: > > > > Hi, > > > > Hello :) > > > Currently exit() is implemented using bailout and unclean shutdown, which > > means that we're going to perform a longjmp back to the top-level s

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Marcio Almada
> I have one simple suggestion: Introduce `EngineShutdown -> Throwable`, > bind `exit|die` to it but disallow > `catch(\EngineShutdown $e)` at compile time. This would allow keeping > backwards compatibility to > scenario 2 without messing with our current exception hierarchy. > > > Nikita > Sorry

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Marcio Almada
Em sex, 11 de out de 2019 às 08:05, Nikita Popov escreveu: > > Hi, > Hello :) > Currently exit() is implemented using bailout and unclean shutdown, which > means that we're going to perform a longjmp back to the top-level scope and > let the memory manager clean up all the memory it knows about.

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Claude Pache
> Le 11 oct. 2019 à 13:05, Nikita Popov a écrit : > > I'm mainly wondering how exactly we'd go about integrating this in the > existing exception hierarchy. Assuming that it is desirable to allow people > to actually catch this exception, my first thought would be along these > lines: > > Thro

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Sebastian Bergmann
Am 11.10.2019 um 13:05 schrieb Nikita Popov: Depending on the implementation, we could also allow code to actually catch this exception, which may be useful for testing scenarios, as well as long-running daemons. This sounds interesting :) Anyone have thoughts on this matter? I think \Throw

Re: [PHP-DEV] exit() via exception

2019-10-11 Thread Andreas Hennings
I would think that whichever code currently calls exit() is already expecting and accepting all the consequences, and assumes that this won't ever be caught. So, would it be an option to keep exit() as it is, and introduce a new syntax construction? Places where I have seen exit() were not really

[PHP-DEV] exit() via exception

2019-10-11 Thread Nikita Popov
Hi, Currently exit() is implemented using bailout and unclean shutdown, which means that we're going to perform a longjmp back to the top-level scope and let the memory manager clean up all the memory it knows about. Anything not allocated using ZMM is going to leak persistently. For me, one of t