Make WordPress Core

Ticket #63794: fix-array-conversion.patch

File fix-array-conversion.patch, 943 bytes (added by balvantk, 12 months ago)

Patch to fix PHP array to string conversion notice added. Please review.

  • src/wp-includes/general-template.php

    diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
    index d88bc5ccfa..09d344dd1e 100644
    a b if ( PHP_VERSION_ID < 80100 ) {  
    53075307 * @return string HTML attribute or empty string.
    53085308 */
    53095309function __checked_selected_helper( $helper, $current, $display, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
    5310        
    5311         $helper  = is_array( $helper ) ? ( isset( $helper[0] ) ? sanitize_text_field( $helper[0] ) : '' ) : sanitize_text_field( $helper );
    5312         $current = is_array( $current ) ? ( isset( $current[0] ) ? sanitize_text_field( $current[0] ) : '' ) : sanitize_text_field( $current );
    5313 
    53145310        if ( (string) $helper === (string) $current ) {
    53155311                $result = " $type='$type'";
    53165312        } else {