Skip to content

Commit cfb02ce

Browse files
committed
Ensure SVG icon is a string
1 parent 2848245 commit cfb02ce

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ public static function get_svg( $group, $icon, $size ) {
181181
*
182182
* @since Twenty Twenty-One 1.0
183183
*
184-
* @param array $arr Array of icons.
184+
* @param array<string, string> $arr Array of icons.
185185
*/
186186
$arr = apply_filters( "twenty_twenty_one_svg_icons_{$group}", $arr );
187187

188188
$svg = '';
189-
if ( array_key_exists( $icon, $arr ) ) {
189+
if ( isset( $arr[ $icon ] ) && is_string( $arr[ $icon ] ) ) {
190190
$repl = sprintf( '<svg class="svg-icon" width="%d" height="%d" aria-hidden="true" role="img" focusable="false" ', $size, $size );
191191

192192
$svg = (string) preg_replace( '/^<svg /', $repl, trim( $arr[ $icon ] ) ); // Add extra attributes to SVG code.

0 commit comments

Comments
 (0)