Skip to content

Fix GH-13204: glob() fails if square bracket is in current directory#19647

Merged
ndossche merged 2 commits intophp:masterfrom
ndossche:fix-13204
Mar 3, 2026
Merged

Fix GH-13204: glob() fails if square bracket is in current directory#19647
ndossche merged 2 commits intophp:masterfrom
ndossche:fix-13204

Conversation

@ndossche
Copy link
Member

@ndossche ndossche commented Aug 30, 2025

The problem is not limited to square brackets, but to every meta character. The solution is to override the glob functions for handling paths with the VCWD ones in PHP. If that is not available, use the old but limited workaround.
This is now a viable solution on more platforms as we now bundle a glob implementation.

@ndossche ndossche linked an issue Aug 30, 2025 that may be closed by this pull request
@ndossche ndossche marked this pull request as ready for review August 30, 2025 22:19
@ndossche ndossche requested a review from bukka as a code owner August 30, 2025 22:19
The problem is not limited to square brackets, but to every meta
character. The solution is to override the glob functions for handling
paths with the VCWD ones in PHP. If that is not available, use the old
but limited workaround.
Copy link
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

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

Looks good to me!

* to prepending the current working directory to the passed path.
* However, that comes with limitations regarding meta characters
* that is not solvable in general (GH-13204). */
#ifdef PHP_GLOB_ALTDIRFUNC
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Indent after #

@ndossche ndossche merged commit 84b0a73 into php:master Mar 3, 2026
18 checks passed
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.

glob() fails if square bracket is in current directory

2 participants