Re: [RFC] [VOTE] Transform exit() from a languageconstructinto a standard function

From: Date: Mon, 05 Aug 2024 19:37:51 +0000
Subject: Re: [RFC] [VOTE] Transform exit() from a languageconstructinto a standard function
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Monday, 5 August 2024 at 18:30, Christoph M. Becker <[email protected]> wrote:

> On 05.08.2024 at 18:52, Tim Düsterhus wrote:
> 
> > On 8/5/24 14:52, Christoph M. Becker wrote:
> > 
> > > Hmm, so far I only had skimmed the RFC and the related discussions, but
> > > now I checked out the suggested implementation[1]. Then I tried to
> > > build with PECL/uopz, and of course that failed because ZEND_EXIT is no
> > > longer there. Okay, quickly drop that usage; build succeeds. Then I ran
> > > 
> > > <?php
> > > uopz_set_return("exit", function () {echo "hello";}, true);
> > > exit;
> > > ?>
> > > 
> > > And got
> > > 
> > > hello
> > > 
> > > Previously, no output was echoed. While that seems to be fixable in
> > 
> > Frankly from a userland developer PoV this looks entirely correct: If I
> > override the exit() function, then I expect the exit() function
> > to
> > be overridden.
> 
> 
> I should have clarified, that "fixing" means to restore the expected
> behavior of uopz, namely that accidential attempts to override exit with
> uopz_set_return() were silently ignored, but unless uopz.exit=1 is
> set, or uopz_allow_exit(true) is called, exit is ignored. Especially
> the latter may be relied upon by tests for legacy code.
> 
> Christoph

This sounds like a uopz extension issue that is easily fixed.
I am not sure why we should bend over backwards for extensions that allow to break usual userland
semantics while preventing userland behaviour to be better.


Best regards,

Gina P. Banyard


Thread (37 messages)

« previous php.internals (#124788) next »