Make WordPress Core

Changeset 57928

Timestamp:
04/04/2024 06:53:39 PM (4 months ago)
Author:
joemcgill
Message:

Themes: Avoid errors in some environments from _get_block_templates_paths.

This adds an is_dir() check in _get_block_templates_paths before trying to run a RecursiveDirectoryIterator to avoid errors being reported in New Relic even thought the errors should be handled by a try/catch block.

Follow-up to [57215].

Props iCaleb, sean212, mukesh27, joemcgill.
Fixes #60915.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-template-utils.php

    r57919 r57928  
    230230    }
    231231    $path_list = array();
    232     try {
     232    {
    233233        $nested_files      = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $base_directory ) );
    234234        $nested_html_files = new RegexIterator( $nested_files, '/^.+\.html$/i', RecursiveRegexIterator::GET_MATCH );
     
    236236            $path_list[] = $path;
    237237        }
    238     } catch ( Exception $e ) {
    239         // Do nothing.
    240238    }
    241239    $template_path_list[ $base_directory ] = $path_list;
Note: See TracChangeset for help on using the changeset viewer.