[11.x] Fix PHP_MAXPATHLEN check for strings slightly smaller then PHP_MAXPATHLEN #51850
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #50962 we fixed a bug that was supposed to fix the
PHP_MAXLENGHT
problem with the OpenBasedir configuration. This fix was wrong, because the PHP variablePHP_MAXLENGHT
behaves differently than the name suggests. In fact, files can have a maximum length ofPHP_MAXLENGHT - 1
character [1].Because the test was also faulty and did not take the path into account internally, the test was unable to detect the error.
This pull request fixes both the test (see the first commit), which shows that the problem still exists (see the tests from the first commit) and the actual problem in the second commit.
[1] https://github.com/php/php-src/blob/7c860628cd2bf11ee867bfb41b3fd0314c5177c5/main/fopen_wrappers.c#L301