Skip to content

Conversation

bishopb
Copy link
Contributor

@bishopb bishopb commented Jan 9, 2018

If given a non-existent path that exceeds the build-defined maximum path length, we should not find the file -- rather than dumping core as described in the bug report. This PR adds a test asserting the buggy behavior reported in 2014 doesn't re-appear.

https://bugs.php.net/bug.php?id=66960

Note that the use of __DIR__ in this test is as a temporary directory, as I'm not sure tests can rely upon sys_get_temp_dir() to reliably avoid test false failures.

If given a non-existent path that exceeds the build defined maximum path
length, we should just not find the file rather than dumping core.
@bishopb bishopb changed the title Let's be sure about long paths. Fixes Bug #66960 Jan 9, 2018
@krakjoe krakjoe added the Bug label Jan 9, 2018
@nikic
Copy link
Member

nikic commented Jan 12, 2018

Putting it in the current directory is fine, but there should be a --CLEAN-- section (https://qa.php.net/write-test.php#clean) to remove the file again.

As a general note, phpt tests should use var_dump rather than assert. Apart from assert not being guaranteed to execute (you'd need to specify additional inis), it is not debuggable. It's borderline in this case because you can infer from the assertion failure that the return value is true rather than false, but apart from the case of booleans specifically, assert does not tell you what the actual value was, which is especially important for CI failures which cannot be directly debugged.

@bishopb
Copy link
Contributor Author

bishopb commented Jan 13, 2018

@nikic I appreciate the feedback, thank you and addressed.

@nikic
Copy link
Member

nikic commented Jan 15, 2018

Merged as cb73872, thanks!

@nikic nikic closed this Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants