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

fix file() flags error-check #11483

Closed
wants to merge 4 commits into from

Conversation

divinity76
Copy link
Contributor

@divinity76 divinity76 commented Jun 19, 2023

the old flag check was flawed and would miss some invalid flags, for example:

file(__FILE__, FILE_APPEND);

is invalid, but the old flags error check would miss it: https://3v4l.org/b2W9u

the new check is also about 7% faster: https://quick-bench.com/q/j3k_unXcE91gVdTRH9Dm0nxpDUA

the old flag check was flawed and would miss some flags, for example:
file(__FILE__, FILE_APPEND);
is invalid, but the old flags error check would miss it: https://3v4l.org/b2W9u
@divinity76
Copy link
Contributor Author

i think the ASAN_DEBUG_NTS test just randomly failed for completely unrelated reasons. anyone know how to re-run it? can't find a "re-run test" button 🤔

@nielsdos
Copy link
Member

i think the ASAN_DEBUG_NTS test just randomly failed for completely unrelated reasons. anyone know how to re-run it? can't find a "re-run test" button thinking

Only maintainers can re-run it. But it's fine, it's a known flaky test.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Thank you! This change makes sense to me. We'll need to document accordingly (in UPGRADING).

ext/standard/file.c Outdated Show resolved Hide resolved
@staabm
Copy link
Contributor

staabm commented Jun 22, 2023

Just fyi: I borrowed the idea and implemented a check in PHPStan, so we can detect similar errors even on older PHP versions

phpstan/phpstan-src#2476

@divinity76
Copy link
Contributor Author

divinity76 commented Jun 22, 2023

@iluuu1994 added note in UPGRADING (and that caused a merge conflict, but fixed it)

@iluuu1994
Copy link
Member

Thanks! Let's wait for Jakubs review since he's code owner.

@iluuu1994 iluuu1994 self-assigned this Jun 23, 2023
@iluuu1994 iluuu1994 closed this in 3b0e619 Jun 23, 2023
@iluuu1994
Copy link
Member

Thanks @divinity76!

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.

None yet

5 participants