From 27c3a5cac12ba68ed30b05cb745b59e61d1a300a Mon Sep 17 00:00:00 2001 From: Jenisha Munikar Date: Tue, 4 Aug 2026 14:55:50 +0545 Subject: [PATCH 1/2] fix: deprecated wp_script_add_data() conditional notice on wp 6.9+ Only add the 'conditional' script data for html5shiv on WP < 6.9, since core dropped IE conditional comment output in 6.9 and the argument is deprecated there. --- inc/enqueue-scripts.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/enqueue-scripts.php b/inc/enqueue-scripts.php index 22274b3..c887fc5 100644 --- a/inc/enqueue-scripts.php +++ b/inc/enqueue-scripts.php @@ -122,7 +122,11 @@ function spacious_scripts_styles_method() { wp_enqueue_script( 'spacious-custom', SPACIOUS_JS_URL . '/spacious-custom.js', array( 'jquery' ) ); wp_enqueue_script( 'html5', SPACIOUS_JS_URL . '/html5shiv.min.js', true ); - wp_script_add_data( 'html5', 'conditional', 'lte IE 8' ); + // The 'conditional' data key is deprecated since WP 6.9.0 and has no effect there; + // only set it on older versions to keep html5 restricted to IE8 and below. + if ( version_compare( $GLOBALS['wp_version'], '6.9', '<' ) ) { + wp_script_add_data( 'html5', 'conditional', 'lte IE 8' ); + } } add_action( 'wp_enqueue_scripts', 'spacious_scripts_styles_method' ); From 68cf169ae1c984831f130a7352000e82961326ad Mon Sep 17 00:00:00 2001 From: Jenisha Munikar Date: Tue, 4 Aug 2026 14:57:27 +0545 Subject: [PATCH 2/2] fix: deprecated hexdec() notice when primary color uses alpha spacious_hex2rgb() and spacious_darkcolor() assumed the primary color theme mod is always a hex string, but its customizer control allows an rgba() value. Passing that to hexdec() triggered PHP 8.3's "invalid characters" deprecation and silently produced an invalid color. Normalize rgba() input to hex first via a shared spacious_color_to_hex() helper. --- inc/functions.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 6674119..041cbe1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -313,11 +313,29 @@ function spacious_sidebar_select() { /** * Change hex code to RGB - * Source: https://css-tricks.com/snippets/php/convert-hex-to-rgb/#comment-1052011 */ +if ( ! function_exists( 'spacious_color_to_hex' ) ) { + /** + * Normalize a color value to a bare hex string. + * + * The primary color customizer control allows picking an alpha color, so the + * stored value can be an `rgba(r,g,b,a)` string rather than a hex string. + * hexdec() doesn't understand that format, so convert it to hex first. + */ + function spacious_color_to_hex( $color ) { + if ( preg_match( '/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i', $color, $matches ) ) { + return str_pad( dechex( (int) $matches[1] ), 2, '0', STR_PAD_LEFT ) + . str_pad( dechex( (int) $matches[2] ), 2, '0', STR_PAD_LEFT ) + . str_pad( dechex( (int) $matches[3] ), 2, '0', STR_PAD_LEFT ); + } + + return str_replace( '#', '', $color ); + } +} + if ( ! function_exists( 'spacious_hex2rgb' ) ) { function spacious_hex2rgb( $hexstr ) { - $int = hexdec( str_replace( '#', '', $hexstr ) ); + $int = hexdec( spacious_color_to_hex( $hexstr ) ); $rgb = array( "red" => 0xFF & ( $int >> 0x10 ), "green" => 0xFF & ( $int >> 0x8 ), "blue" => 0xFF & $int ); $r = $rgb['red']; @@ -337,7 +355,7 @@ function spacious_darkcolor( $hex, $steps ) { $steps = max( -255, min( 255, $steps ) ); // Normalize into a six character long hex string - $hex = str_replace( '#', '', $hex ); + $hex = spacious_color_to_hex( $hex ); if ( strlen( $hex ) == 3 ) { $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 ); }