Skip to content

Allow usage of environment variables in PHP ini settings that contain byte size values #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

graste
Copy link

@graste graste commented May 26, 2025

I ran into a problem where the IniUtil::iniSizeToBytes function threw errors due to the usage of environment variables inside PHP ini settings to configure size values.

Example:

memory_limit=${PHP_MEMORY_LIMIT}
post_max_size=$PHP_POST_MAX_SIZE

This might be used e.g. in docker setups where the container gets post_max_size, memory_limit etc values via environment variables instead of providing different ini files per environments via mounts.

I suggest the changes within this pull request. I didn't add a changelog entry, as I don't know your rules for this. The used regular expression should work w/ PCRE and PCRE2 if I'm not mistaken. I didn't verify performance aspects, but usage of the function seems to be in constructors only. PS: That last string cast is not phpstan level 10 compatible. 🗡️

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

Successfully merging this pull request may close these issues.

1 participant