Allow usage of environment variables in PHP ini settings that contain byte size values #544
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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. 🗡️