danieltj27 / Cece

The little blogging framework.
MIT License
0 stars 0 forks source link

Extensions folder doesn't exist and returns warning #7

Closed danieltj27 closed 5 months ago

danieltj27 commented 5 months ago

When there is no Extensions folder present, the following warning is triggered.

Warning: scandir(/Users/dan/Local Sites/blog/app/public/Content/Extensions/): Failed to open directory: No such file or directory in /Users/dan/Local Sites/blog/app/public/Cece/Functions/Extensions.php on line 113

Line 113 is the array_diff

function get_extensions() {

    // Get all extension directories.
    $dirs = array_diff( scandir( CECEEXTEND ), array( '.', '..', '.svn', '.git', '.DS_Store', 'Thumbs.db' ) );

Which is also returning a fatal error as well.

Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, bool given in /Users/dan/Local Sites/blog/app/public/Cece/Functions/Extensions.php:113 Stack trace: #0 /Users/dan/Local Sites/blog/app/public/Cece/Functions/Extensions.php(113): array_diff(false, Array) #1 /Users/dan/Local Sites/blog/app/public/Cece/App.php(340): get_extensions() #2 /Users/dan/Local Sites/blog/app/public/Cece/App.php(106): App->prepare_extensions() #3 /Users/dan/Local Sites/blog/app/public/index.php(24): App->init() #4 {main} thrown in /Users/dan/Local Sites/blog/app/public/Cece/Functions/Extensions.php on line 113

Need protection in this function if the folder doesn't exist which in to be honest should sometimes be expected on new installs.

danieltj27 commented 5 months ago

Fixed in c2c2a03