http icon indicating copy to clipboard operation
http copied to clipboard

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

Open graste opened this issue 7 months ago • 0 comments

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. :dagger:

graste avatar May 26 '25 13:05 graste