Errors
- Gemini built a bundler that puts the zipcontents in a subfolder which WP didn't like
- New errors show up in the functions.php:
[22-Feb-2026 13:00:13 UTC] PHP Warning: scandir(/home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/blocks): Failed to open directory: No such file or directory in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:00:13 UTC] PHP Warning: scandir(): (errno 2): No such file or directory in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:00:13 UTC] PHP Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, false given in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php:129
Stack trace:
#0 /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php(129): array_diff(false, Array)
#1 /home2/ab6506/venture.moondogdev.com/wp-includes/class-wp-hook.php(341): {closure}('')
#2 /home2/ab6506/venture.moondogdev.com/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array)
#3 /home2/ab6506/venture.moondogdev.com/wp-includes/plugin.php(522): WP_Hook->do_action(Array)
#4 /home2/ab6506/venture.moondogdev.com/wp-settings.php(742): do_action('init')
#5 /home2/ab6506/venture.moondogdev.com/wp-config.php(102): require_once('/home2/ab6506/v...')
#6 /home2/ab6506/venture.moondogdev.com/wp-load.php(50): require_once('/home2/ab6506/v...')
#7 /home2/ab6506/venture.moondogdev.com/wp-blog-header.php(13): require_once('/home2/ab6506/v...')
#8 /home2/ab6506/venture.moondogdev.com/index.php(17): require('/home2/ab6506/v...')
#9 {main}
thrown in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:03:29 UTC] PHP Warning: scandir(/home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/blocks): Failed to open directory: No such file or directory in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:03:29 UTC] PHP Warning: scandir(): (errno 2): No such file or directory in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:03:29 UTC] PHP Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, false given in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php:129
Stack trace:
#0 /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php(129): array_diff(false, Array)
#1 /home2/ab6506/venture.moondogdev.com/wp-includes/class-wp-hook.php(341): {closure}('')
#2 /home2/ab6506/venture.moondogdev.com/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array)
#3 /home2/ab6506/venture.moondogdev.com/wp-includes/plugin.php(522): WP_Hook->do_action(Array)
#4 /home2/ab6506/venture.moondogdev.com/wp-settings.php(742): do_action('init')
#5 /home2/ab6506/venture.moondogdev.com/wp-config.php(102): require_once('/home2/ab6506/v...')
#6 /home2/ab6506/venture.moondogdev.com/wp-load.php(50): require_once('/home2/ab6506/v...')
#7 /home2/ab6506/venture.moondogdev.com/wp-cron.php(46): require_once('/home2/ab6506/v...')
#8 {main}
thrown in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:10:08 UTC] PHP Warning: scandir(/home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/blocks): Failed to open directory: No such file or directory in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:10:08 UTC] PHP Warning: scandir(): (errno 2): No such file or directory in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
[22-Feb-2026 13:10:08 UTC] PHP Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, false given in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php:129
Stack trace:
#0 /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php(129): array_diff(false, Array)
#1 /home2/ab6506/venture.moondogdev.com/wp-includes/class-wp-hook.php(341): {closure}('')
#2 /home2/ab6506/venture.moondogdev.com/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array)
#3 /home2/ab6506/venture.moondogdev.com/wp-includes/plugin.php(522): WP_Hook->do_action(Array)
#4 /home2/ab6506/venture.moondogdev.com/wp-settings.php(742): do_action('init')
#5 /home2/ab6506/venture.moondogdev.com/wp-config.php(102): require_once('/home2/ab6506/v...')
#6 /home2/ab6506/venture.moondogdev.com/wp-load.php(50): require_once('/home2/ab6506/v...')
#7 /home2/ab6506/venture.moondogdev.com/wp-cron.php(46): require_once('/home2/ab6506/v...')
#8 {main}
thrown in /home2/ab6506/venture.moondogdev.com/wp-content/themes/wp-scratch-1.0.4/functions.php on line 129
The error is occurring because your theme is trying to scan a folder named /blocks that doesn't exist in your theme directory. When scandir() can't find the folder, it returns false instead of a list of files. Since array_diff() requires an actual array to work, PHP throws a Fatal Error and crashes your site. The Fix
You should wrap that logic in a check to see if the directory exists before trying to scan it. Replace the block of code at the end of your functions.php file (starting around line 127) with this safer version:
add_action( 'init', function() {
$blocks_dir = get_template_directory() . '/blocks';
// 1. Check if the directory actually exists first
if ( ! is_dir( $blocks_dir ) ) {
return;
}
$scanned_dir = scandir( $blocks_dir );
// 2. Ensure scandir didn't return false before passing to array_diff
if ( ! is_array( $scanned_dir ) ) {
return;
}
$folders = array_diff( $scanned_dir, array( '..', '.' ) );
foreach ( $folders as $folder ) {
$path = $blocks_dir . '/' . $folder;
if ( file_exists( $path . '/block.json' ) ) {
// Register the block first
register_block_type( $path );
// Now override the script loading to ensure dependencies are forced
add_action( 'enqueue_block_editor_assets', function() use ( $folder, $path ) {
$script_uri = get_template_directory_uri() . '/blocks/' . $folder . '/index.js';
wp_enqueue_script(
$folder . '-script',
$script_uri,
array( 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-components' ),
file_exists( $path . '/index.js' ) ? filemtime( $path . '/index.js' ) : '1.0.0',
true // Load in footer
);
// Pass theme directory URI to the script
wp_localize_script( $folder . '-script', 'wpScratchTheme', array(
'themeUrl' => get_template_directory_uri()
));
});
}
}
});
Why this happened:
-
Missing Folder: Your code looks for /wp-content/themes/wp-scratch-1.0.4/blocks. If you haven't created that folder yet, or if it was deleted, the script fails.
-
PHP 8 strictness: In older versions of PHP, passing false to array_diff might have only triggered a warning. In PHP 8.x (which you appear to be running), it is a Fatal Error that stops the site from loading.
Next Steps:
-
Create the folder: If you intended to use custom blocks, create a folder named blocks inside your theme directory via FTP or your File Manager.
-
Verify Permissions: Ensure the web server has permission to read that directory.
Troubleshooting
I was able to install the theme by unzipping the theme and rezipping it myself so need to explore if the issue is letting ps handle zips or the filename match. going to remove version numbers and