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

Remove " " being considered as an invalid filename for is_file() #7186

Merged

Conversation

patrickallaert
Copy link
Contributor

Some builds fail because of it, last one to date is: https://travis-ci.com/github/php/php-src/jobs/517817543

@ramsey
Copy link
Member

ramsey commented Jun 22, 2021

Looks like that was added to the test 13 years ago: f689708

@ramsey
Copy link
Member

ramsey commented Jun 22, 2021

I've been trying to think through this and figure out whether a space character should still be tested, but if space can be a valid filename, then is_file() shouldn't always return false. So, removing it from the test is the right approach, since this test assumes space is an invalid value.

@nikic
Copy link
Member

nikic commented Jun 22, 2021

This is probably test parallelisation issue. Some other test must be creating that file, else it wouldn't exist.

@patrickallaert
Copy link
Contributor Author

Looks like that was added to the test 13 years ago: f689708

Indeed, what I wonder is how many failed builds have been triggered by this one.

@ramsey
Copy link
Member

ramsey commented Jun 22, 2021

This is probably test parallelisation issue. Some other test must be creating that file, else it wouldn't exist.

I also think this is what is happening, but if a space is a valid file name, then is_file() should return true for it, and this test assumes space is an invalid file name value, so it's trying to assert that it always returns false, which isn't the case.

Given that, it seems to me this is safe to remove.

Why anyone would want to use U+0020 as a file name, I have no idea. 🤷🏻‍♂️

@krakjoe
Copy link
Member

krakjoe commented Jun 23, 2021

Nowadays, we don't test ZPP, and will refuse to merge such tests. This test was clearly written to test the 'p' specifier for ZPP, and some false assumptions were made about how paths were handled at that time.

IMO the test should be removed, or rewritten so that it makes sense. If this test provides no additional coverage to php_stat, then drop it.

@patrickallaert
Copy link
Contributor Author

Nowadays, we don't test ZPP, and will refuse to merge such tests. This test was clearly written to test the 'p' specifier for ZPP, and some false assumptions were made about how paths were handled at that time.

IMO the test should be removed, or rewritten so that it makes sense. If this test provides no additional coverage to php_stat, then drop it.

Did tests with code coverage with and without the file: no changes to the whole filestat.c (containing php_stat).
Should I adapt this PR to drop the whole file @krakjoe?

@krakjoe
Copy link
Member

krakjoe commented Jun 23, 2021

Yes please.

@patrickallaert patrickallaert force-pushed the fix-not-incorrect-is_file-value branch from 9991a2f to a235dc1 Compare June 23, 2021 15:57
Those were testing the `p` parameter for ZPP.
@patrickallaert patrickallaert force-pushed the fix-not-incorrect-is_file-value branch from a235dc1 to f626de2 Compare June 23, 2021 15:59
@patrickallaert patrickallaert merged commit 182e3ac into php:master Jun 23, 2021
@patrickallaert patrickallaert deleted the fix-not-incorrect-is_file-value branch June 23, 2021 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants