Re: Automatically execute Closures returned from primary script

From: Date: Wed, 23 Sep 2026 13:43:58 +0000
Subject: Re: Automatically execute Closures returned from primary script
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-132604@lists.php.net to get a copy of this message
Hi On 2026-09-22 23:12, Levi Morrison wrote:
this thread concerns my PR carrying the same title as this email: https://github.com/php/php-src/pull/23658, where Gina requested that I ask the mailing list for opinions and/or objections against the feature.
Why is this PR scoped to the CLI SAPI? Shouldn't it apply equally to any SAPI's top-level script?
The “file is both a library and executable” use case is only really a thing for a single-file deployment, because otherwise you could just separate the executable bit into a different file. I believe that making a library do something useful when executed directly is something that would work for the CLI SAPI. In web contexts, where the front-controller pattern is already well-established and where you generally have an allow-list of legal entrypoints (mostly just your front-controller) for security reasons I don't see it working well. Best regards Tim Düsterhus

« previous php.internals (#132604) next »