Skip to content

Unable to load customizer due to unset header column widths #36

@W3ap0n-X

Description

@W3ap0n-X

Unset header column widths causing 500 internal server error in customizer

To Reproduce
Issue was reported by customer and I was able to replicate it on a clone of his site. Initial cause is unknown but for whatever reason the $raw_col_widths['media'] array was empty preventing the customizer from loading. Was able to use echo and var_dump() to generate the following example from the cloned site:

type: header
var_dump(raw_col_widths):
array(4) { ["css"]=> string(412) "@media only screen and ( max-width: 767px ){.site-header header row{width:3col;width:3col;}}@media only screen and (max-width: 991px) and (min-width: 768px){.site-header header row{width:3col;width:3col;}}@media only screen and (max-width: 1199px) and (min-width: 992px){.site-header header row{width:3col;width:3col;}}@media only screen and ( min-width: 1200px ){.site-header header row{width:3col;width:3col;}}" ["media"]=> array(0) { } ["ID"]=> int(0) ["filter"]=> string(3) "raw" }

Additional context
Was able to resolve the issue by replacing the if/else statement with the following on class-boldgrid-framework-api.php:1105 :

		if ( is_string( $raw_col_widths ) ) {
			$col_width_theme_mod = json_decode( $raw_col_widths, true );
		} else {
			if ( empty( $raw_col_widths['media'] ) ) {
				$raw_col_widths = $configs['customizer']['controls']['bgtfw_header_layout_col_width']['default'];
			}
			$col_width_theme_mod = isset( $raw_col_widths['media'] )
				? json_decode( $raw_col_widths['media'], true )
				: $raw_col_widths[0]['media'];
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions