Re: [RFC] Exposed parsed value of php.ini numeric directives
| From: | Dennis Snell | Date: | Tue, 10 May 2022 01:20:02 +0000 |
| Subject: | Re: [RFC] Exposed parsed value of php.ini numeric directives | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-117709@lists.php.net to get a copy of this message | ||
>
ini_get_size($option) would be nice to have, but may not be
>feasible,
see <https://github.com/php/php-src/pull/8380#issuecomment-1100226598
>.
I concur and did start by exploring this idea. It raised too many questions when a simpler interface
seemed
to accomplish what we need in practice.
> I guess it could [have ]be[en] useful to Symfony too:
It's my presumption that many projects have had to build some workaround, most of which are
defective in a
range of plausible values (such as the linked Symphony code that interprets a t when
PHP doesn't). Adding
this scope-limited function could be dramatic in removing the need to port PHP internals to outside
projects.
> Regarding the name: What about 'ini_get_as_bytes()'? It makes the
relationship with 'ini_get()' clear by using the same prefix and the
suffix should be reasonable explanatory in what happens.
> Just not sure whether it should be e.g. ini_get_size($option)
> (like
ini_get) or rather e.g. ini_parse_size($value) (more generally
usable).
Given that many non-memory-size configuration settings also currently use this same parsing flow I
have been
mixed on associating this with "byte sizes" the way the PHP docs indicate. In fact, based
on the work in #7951
I've renamed my proposed function to ini_parse_quantity( $shorthand ) and rather
like the match between
the implementation and meaning.
---
Dennis Snell