Re: Revisiting case-sensitivity in PHP
On Tuesday, 11 June 2024 at 15:38, Valentin Udaltsov <[email protected]> wrote:
> Hi, Ben and Levi! Thank you for your interest!
>
> Could you, please, elaborate on why you propose to target 9.0? That would make perfect sense if
> PHP strictly followed semver, but we always have some BC breaks in minor releases
> (https://www.php.net/manual/en/migration82.incompatible.php, https://www.php.net/manual/en/migration83.incompatible.php).
> So, is there a real difference between 8.4 and 9.0 for this case? Or do you mean that this BC break
> is way too big for 8.4?
>
> Levi, if we bundle namespaces, classes and functions in a single change, will that be easier to
> implement? Basically to remove lowercasing and put the original type names in the lookup tables?
While we do make backwards incompatible breaks in minor PHP version (and we have done since the
beginning of time, I checked last time this argument came up) we do keep them to a minimum and to be
"small" BC breaks, the judgement of what "small" means is fuzzy.
Plenty of us thought converting resources to opaque object was "small" but others
disagreed.
And I agree with Levi here, I am in favour of this change, but I don't think it should land in
a minor.
For PHP the namespace is just a prefix to any symbol to be able to distinguish them, and namespaces
are already canonicalized to be lowercase, this has been an issue when trying to remove the memory
footprint of constants, as the casing of namespace was lost. [1][2][3]
Indeed you can access a namespace constant with two different casing in the namespace. [4]
One difficulty is that checking the casing at runtime for all classes/functions to check if they are
conformant would likely lead to a big performance degradation.
It _might_ be possible to check some of these things at compile time (well at least for functions)
if the class/function is already available in the symbol table.
Best regards,
Gina P. Banyard
[1] https://github.com/php/php-src/pull/10954
[2] https://github.com/php/php-src/issues/11423
[3] https://github.com/php/php-src/pull/11604
[4] https://3v4l.org/ju4F0
>
Thread (18 messages)