diff --git a/system/Helpers/filesystem_helper.php b/system/Helpers/filesystem_helper.php index da6acabb039e..b33ad49a2823 100644 --- a/system/Helpers/filesystem_helper.php +++ b/system/Helpers/filesystem_helper.php @@ -281,8 +281,11 @@ function get_dir_file_info(string $sourceDir, bool $topLevelOnly = true, bool $r if (is_dir($sourceDir . $file) && $file[0] !== '.' && $topLevelOnly === false) { get_dir_file_info($sourceDir . $file . DIRECTORY_SEPARATOR, $topLevelOnly, true); } elseif ($file[0] !== '.') { - $fileData[$file] = get_file_info($sourceDir . $file); - $fileData[$file]['relative_path'] = $relativePath; + $info = get_file_info($sourceDir . $file); + if ($info !== null) { + $fileData[$file] = $info; + $fileData[$file]['relative_path'] = $relativePath; + } } } diff --git a/user_guide_src/source/changelogs/v4.7.5.rst b/user_guide_src/source/changelogs/v4.7.5.rst index 964133046c38..75c7dcc4c38e 100644 --- a/user_guide_src/source/changelogs/v4.7.5.rst +++ b/user_guide_src/source/changelogs/v4.7.5.rst @@ -31,6 +31,7 @@ Bugs Fixed ********** - **Content Security Policy:** Fixed a bug where empty ``Content-Security-Policy``, ``Content-Security-Policy-Report-Only``, and ``Reporting-Endpoints`` response headers were generated when no corresponding values existed. +- **Helpers:** Fixed a bug where ``get_dir_file_info()`` could cause a null pointer error when ``get_file_info()`` returns null. - **Logger:** Fixed a bug where interpolating a log message with array or non-stringable context values could raise PHP warnings or errors. See the repo's