Skip to content

Commit

Permalink
fix: TypeError by is_file()
Browse files Browse the repository at this point in the history
COMPOSER_PATH may be false.

PHP Fatal error:  Uncaught TypeError: is_file(): Argument #1 ($filename) must be of type string, bool given in /home/runner/work/CodeIgniter4/CodeIgniter4/system/Autoloader/Autoloader.php:126
  • Loading branch information
kenjis committed Dec 9, 2023
1 parent e91e5b6 commit e962fc0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function initialize(Autoload $config, Modules $modules)
$this->helpers = [...$this->helpers, ...$config->helpers];
}

if (is_file(COMPOSER_PATH)) {
if (COMPOSER_PATH !== false && is_file(COMPOSER_PATH)) {
$this->loadComposerAutoloader($modules);
}

Expand Down
2 changes: 1 addition & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function initialize()
Services::exceptions()->initialize();

// Run this check for manual installations
if (! is_file(COMPOSER_PATH)) {
if (COMPOSER_PATH !== false && ! is_file(COMPOSER_PATH)) {
$this->resolvePlatformExtensions(); // @codeCoverageIgnore
}

Expand Down
2 changes: 1 addition & 1 deletion system/Test/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
Services::autoloader()->loadHelpers();

// Now load Composer's if it's available
if (is_file(COMPOSER_PATH)) {
if (COMPOSER_PATH !== false && is_file(COMPOSER_PATH)) {
require_once COMPOSER_PATH;
}

Expand Down

0 comments on commit e962fc0

Please sign in to comment.