fix : fatal error when _PS_CAT_IMG_DIR_ folder does not exists #81
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.
Hello !
scandir()PHP function can returnfalseif the path does not exist or is not a directory (e.g., due to permission issues). In the current code, thisfalsevalue is passed directly topreg_grep(), which expects its second argument to be an array. This causes aTypeError: preg_grep(): Argument #2 ($array) must be of type array, bool given.This PR adds a check to verify the return value of
scandir(). If it returnsfalse, the property$this->imageFilesis initialized as an empty array[]./img/c/) is missing or not readable when generating the module widget variables.