Closed bianqui149 closed 1 year ago
How can the issue be reproduced?
How can the issue be reproduced?
wp-admin-> Appearance ->Customize
$theme_name = get_theme_name();
is equal to false
That's unexpected. Do you have a syntax_highlighting_code_block_style
filter?
The function is supposed to always return a theme, though I can see it won't possibly if you've filtered syntax_highlighting_code_block_style
:
For example:
add_filter( 'syntax_highlighting_code_block_style', '__return_false' );
The customizer setting validates the theme_name
:
So a call to get_plugin_option( 'theme_name' )
should return a valid theme.
Is there something else you did on your site to get to this state?
yupe, i have this filter
add_filter(
'syntax_highlighting_code_block_style',
'__return_false'
);
inside me theme functions
I also have this filter syntax_highlighting_code_block_auto_detect_languages
.
The only thing I did was updating the versions of PHP and WordPress
OK, then as a part of this, we should also update the get_theme_name()
function like so:
@return
tag be: @return string|null Theme name or null if disabled.
return is_string( $style ) ? $style : null;
okay, tested when okay
Thank you for the contribution.
Hotfix for critical error in customize api.
Fatal error: Uncaught DomainException: There is no stylesheet by the name of '' in /app/wp-content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight-php/HighlightUtilities/_themeColors.php:475 Stack trace: #0 /app/wp-content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight-php/HighlightUtilities/functions.php(91): _getThemeBackgroundColor(false) #1 /app/wp-content/plugins/syntax-highlighting-code-block/syntax-highlighting-code-block.php(127): HighlightUtilities\getThemeBackgroundColor(false) #2 /app/wp-content/plugins/syntax-highlighting-code-block/syntax-highlighting-code-block.php(776): Syntax_Highlighting_Code_Block\get_default_line_background_color(false) #3 /app/wp-includes/class-wp-hook.php(308): Syntax_Highlighting_Code_Block\customize_register(Object(WP_Customize_Manager)) #4 /app/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #5 /app/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 /app/wp-includes/class-wp-customize-manager.php(934): do_action('customize_regis...', Object(WP_Customize_Manager)) #7 /app/wp-includes/class-wp-hook.php(308): WP_Customize_Manager->wp_loaded('') #8 /app/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #9 /app/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /app/wp-settings.php(645): do_action('wp_loaded') #11 /app/wp-config.php(121): require_once('/app/wp-setting...') #12 /app/wp-load.php(50): require_once('/app/wp-config....') #13 /app/wp-admin/admin.php(34): require_once('/app/wp-load.ph...') #14 /app/wp-admin/customize.php(13): require_once('/app/wp-admin/a...') #15 {main} thrown in /app/wp-content/plugins/syntax-highlighting-code-block/vendor/scrivo/highlight-php/HighlightUtilities/_themeColors.php on line 475
Tested environments: