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

ext/standard: pathinfo() check flags argument validity. #17859

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

devnexen
Copy link
Member

No description provided.

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting function with a bit of a surprising implementation, ngl.
Note that passing something like PHP_PATHINFO_DIRNAME|PHP_PATHINFO_BASENAME still is allowed but is equivalent to only passing PHP_PATHINFO_DIRNAME as a flag, which is quite bonkers. So perhaps bitwise combinations should also be blocked?

@devnexen
Copy link
Member Author

well PHP_PATHINFO_ALL is itself a combination

@nielsdos
Copy link
Member

well PHP_PATHINFO_ALL is itself a combination

Yeah but that is the only case where you get the array, so it's an exception to the rule that only one flag should be passed.

@devnexen
Copy link
Member Author

yeah quite a bunch of tests to update following this.

@nielsdos
Copy link
Member

yeah quite a bunch of tests to update following this.

Ouch. Then I wonder if this is worth it and whether Hyrum's law applies.

@devnexen
Copy link
Member Author

yeah quite a bunch of tests to update following this.

and whether Hyrum's law applies.

exactly

@TimWolla
Copy link
Member

Then I wonder if this is worth it and whether Hyrum's law applies.

It's effectively the same situation as with the php_uname() fix in PHP 8.4. I consider pointing out the “undefined behavior” to be useful, though.

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, but needs to be listed in UPGRADING as a backwards incompatible change, like

. php_uname() now throws ValueErrors if the $move parameter is invalid.
.

Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have already discussed changes like this in #15647 and #15883 . My suggestion was to go through the deprecations first as those are essentially BC breaks.

We really need to have some consistent strategy for this and mainly some agreement.

@bukka
Copy link
Member

bukka commented Feb 24, 2025

I can see that various change in pcntl got in.

Ideally we should maybe update the policy to extend a bit what kind of breaks are allowed in minor versions and what should go through the deprecations as it's currently pretty inconsistent.

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

Successfully merging this pull request may close these issues.

4 participants