Skip to content
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

Unify case of array keys in ftp_mlsd #18064

Open
domenk opened this issue Mar 14, 2025 · 2 comments
Open

Unify case of array keys in ftp_mlsd #18064

domenk opened this issue Mar 14, 2025 · 2 comments

Comments

@domenk
Copy link

domenk commented Mar 14, 2025

Description

Function ftp_mlsd started returning array with different key case: "name" is still "name", but "type" became "Type" and "modify" became "Modify".

I assume ftp_mlsd returns data as provided by the FTP server and this change was a consequence of our hosting provider modifying the software on FTP server, and not a consequence of changes in PHP.

RFC 3659 states in section 7.5 that fact names are case-insensitive, but because PHP array keys are not, changes like this break the code.

I suggest casing of array keys is unified (always "type" or always "Type").

@nielsdos
Copy link
Member

One problem with normalizing the case to e.g. lowercase is that people who already rely on their server outputting "Type" instead of "type" will have their code break; unless we add the original casing too. WDYT?

@domenk
Copy link
Author

domenk commented Mar 15, 2025

Change like this is of course not backward-compatible, which means it will not be eligible for minor release.

One backward-compatible option is to add a parameter for "key normalisation", for example "keep as is" and "lowercase", default "keep as is". But then there are facts like "UNIX.mode", which (it seems) are usually written as UPPERCASE.lowercase.

Or a parameter "normalise array keys", which would be false by default, but if set to true, sets fact casing as lowercase and UPPERCASE.lowercase (or any other fixed combination of case).

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

No branches or pull requests

2 participants