You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warning: array_key_exists(): The first argument should be either a string or an integer in kirki/includes/class-kirki-fonts.php on line 229
Warning: strpos() expects parameter 1 to be string, array given in kirki/includes/output/property/class-kirki-output-property-font-family.php on line 49
Warning: strpos() expects parameter 1 to be string, array given in
kirki/includes/output/property/class-kirki-output-property-font-family.php on line 49
Ok, after long debugging, sounds like the function is called twice for a single font.
The first time $this->value is an array. the second is a string.
So is like I'm trying to fix something that is broken elseware...
Plus not all the families have a category, so a check is needed there for sure...
Issue description:
Warning: array_key_exists(): The first argument should be either a string or an integer in kirki/includes/class-kirki-fonts.php on line 229
Warning: strpos() expects parameter 1 to be string, array given in kirki/includes/output/property/class-kirki-output-property-font-family.php on line 49
Warning: strpos() expects parameter 1 to be string, array given in
kirki/includes/output/property/class-kirki-output-property-font-family.php on line 49
Version used:
latest dev from today
Using theme_mods or options?
yes
Code to reproduce the issue (config + field(s))
Analysis of the issue:
The issue seems to come in
class-kirki-output-property-font-family.php
Where $this->value is the array so the function works better like this:
`
if ( Kirki_Fonts::is_google_font( $this->value["font-family"] ) ) {
`
ERROR 2: SAME THING:
everywhere it refers to $this->value as string while is always the array, so it works perfectly when we rewrite all the function like this:
`
value = str_replace( '"', '"', $this->value ); // Add backup font. if ( Kirki_Fonts::is_google_font( $this->value["font-family"] ) ) { if ( isset( $google_fonts_array[ $this->value["font-family"] ] ) && isset( $google_fonts_array[ $this->value["font-family"] ]['category'] ) ) { if ( isset( $backup_fonts[ $google_fonts_array[ $this->value["font-family"] ]['category'] ] ) ) { // Add double quotes if needed. if ( false !== strpos( $this->value["font-family"], ' ' ) && false === strpos( $this->value["font-family"], '"' ) ) { $this->value = '"' . $this->value["font-family"] . '", ' . $backup_fonts[ $google_fonts_array[ $this->value["font-family"] ]['category'] ]; } else { $this->value .= ', ' . $backup_fonts[ $google_fonts_array[ $this->value["font-family"] ]['category'] ]; } } } } else { // Add double quotes if needed. if ( false !== strpos( $this->value["font-family"], ' ' ) && false === strpos( $this->value["font-family"], '"' ) ) { $this->value = '"' . $this->value["font-family"] . '"'; } } } } ``` } ` I don't know if i'm doing it right, but now all works perfectly and no errors are thrown... Thanks!!The text was updated successfully, but these errors were encountered: