Skip to content

fix file() flags error-check#11483

Closed
divinity76 wants to merge 4 commits intophp:masterfrom
divinity76:fix-file-flags-check
Closed

fix file() flags error-check#11483
divinity76 wants to merge 4 commits intophp:masterfrom
divinity76:fix-file-flags-check

Conversation

@divinity76
Copy link
Copy Markdown
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
Copy Markdown
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 🤔

@ndossche
Copy link
Copy Markdown
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
Copy Markdown
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).

@staabm
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

divinity76 commented Jun 22, 2023

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

@iluuu1994
Copy link
Copy Markdown
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
Copy Markdown
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.

5 participants