Skip to content

Conversation

shyim
Copy link

@shyim shyim commented Sep 12, 2025

Allows to load a PHP extension by a php.ini like:

extension=${PROFILER}

If PROFILER env is not there, it loads nothing. if there. it loads that extension

@shyim shyim requested a review from bukka as a code owner September 12, 2025 12:21
@henderkes
Copy link

Huh, that's a really cool idea.

@iluuu1994
Copy link
Member

Looks reasonable. Do you mind shooting a quick e-mail to the internals mailing list to ask for feedback? Technically this may still be considered for 8.5 RC1.

@shyim
Copy link
Author

shyim commented Sep 12, 2025

@hakre
Copy link
Contributor

hakre commented Sep 12, 2025

This is already the case. The empty string is ignored, that's why you see the diagnostic message.

What does it diagnose and give you the warning for the benefit: the empty string. It's just not necessary -- don't send an empty directive, it's void. The warning only tells you this already (and not the three+ other permuations that are possible for a non-empty stirng)

The only alternative I can think about is existing with code 254 to fail fast because setting a directive to empty should be diagnosesd as E_DEPRACATED like a since PHP 8.4 function parameter that is just = null without telling per it's type that NULL is included for it's value. Directives are string per their type per the INI directives (at least never NULL) and henceforece PHP 8.4 should have given an E_DEPRECATED error, therefore master should already have rejected with a non-zero status code (likely 254 as it's early) and shutdown.

My 2 cents.

@hakre
Copy link
Contributor

hakre commented Sep 12, 2025

And to add this report is wrong for the extensions named, the directive is zend_extension not extension (as given).

@iluuu1994
Copy link
Member

@hakre

This is already the case. The empty string is ignored, that's why you see the diagnostic message.

What do you mean? This is the same message shown for any non-existent extension.

don't send an empty directive, it's void.

Did you read the original issue? The aim is to have something like:

{if hasEnv("FOO")}
extension=foo.so
{/if}

without having to invent new syntax. Tim suggested a simple approach of ignoring empty extension directives. As mentioned on the list, if the fear is that we might accidentally pass empty environment variables without warning, we could use a different sentinel value. Inventing a new if conditional would be significantly more involved, though also solve more problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants