Re: [PHP-DEV] CLI/CGI -z command line options is broken

Why not make -z an alias for -d zend_extension?

  • Davey

On Feb 15, 2025, at 15:23, Niels Dossche dossche.niels@gmail.com wrote:

On 2/10/25 11:14 PM, Larry Garfield wrote:

On Mon, Feb 10, 2025, at 3:24 PM, Niels Dossche wrote:

Hi internals

We received a bug report (php -z does not seem to work at all · Issue #17740 · php/php-src · GitHub)

that the -z command line option for CLI/CGI doesn’t actually work.

This option is supposed to load a zend extension using a command line

argument.

However, it turns out that the extension doesn’t actually load: PHP

will claim that the extension’s loaded (in some places), but in reality

it never loaded properly.

I did an analysis of why this is happening in that GitHub thread, and a

clean solution isn’t straight-forward.

Christoph figured out that this option has been broken since at least

PHP 5.5, a long time.

As passing -d zend_extension=foo on the command line is already a

suitable replacement, we’d like to just remove the -z option in PHP

8.5 instead of fixing it.

Are there any objections against this? Please let us know.

Kind regards

Niels

Seems reasonable to me. Perhaps update the -d help text accordingly, if needed?

–Larry Garfield

Hi

Just to clarify: the -d option just sets an ini option.
One idea could be to make -z print out a message telling the user to use “-d zend_extension=…”. That would make the transition more “gradual”.
OTOH this didn’t work for ages so nobody realistically relies on this option.

Kind regards
Niels

On 16/02/2025 01:31, Davey Shafik wrote:

Why not make -z an alias for -d zend_extension?

- Davey

Turned out that's not trivial due to escape character handling: php -z does not seem to work at all · Issue #17740 · php/php-src · GitHub

Niels

On 16.02.2025 at 01:34, Niels Dossche wrote:

On 16/02/2025 01:31, Davey Shafik wrote:

Why not make -z an alias for -d zend_extension?

Turned out that's not trivial due to escape character handling: php -z does not seem to work at all · Issue #17740 · php/php-src · GitHub

And even if it was trivial, what practical purpose would that serve? Is
it so common to specify additional zend extensions on the command line
that an own options is justified to avoid a couple of additional characters?

Christoph