Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Warning: Invalid argument supplied for foreach() in /home/customer/www/digitalmarketingevolutions.com/public_html/wp-content/plugins/unyson/framework/includes/option-types/typography-v2/class-fw-option-type-typography-v2.php on line 148 Warning: Invalid argument supplied for foreach() in /home/customer/www/digitalmarketingevolutions.com/public_html/wp-content/plugins/unyson/framework/includes/option-types/typography-v2/class-fw-option-type-typography-v2.php on line 148

Open DigitalMarketingEvolutions opened this issue 2 years ago • 27 comments

How to remove this? I already updated unyson but still there. image

Same problem

Tom2710 avatar Aug 22 '22 12:08 Tom2710

Same problem since this weekend. Mine is Warning: Invalid argument supplied for foreach() in /home/customer/www/doulaschool.ca/public_html/wp-content/plugins/unyson/framework/helpers/general.php on line 1275

DBrthinfo avatar Aug 22 '22 12:08 DBrthinfo

Same issue.

Warning: Invalid argument supplied for foreach() in /home/customer/www/afexsystems.com/public_html/wp-content/plugins/unyson/framework/includes/option-types/typography-v2/class-fw-option-type-typography-v2.php on line 148

Warning: Invalid argument supplied for foreach() in /home/customer/www/afexsystems.com/public_html/wp-content/plugins/unyson/framework/helpers/general.php on line 1275

wingedangeldawn avatar Aug 22 '22 13:08 wingedangeldawn

Same problem here. Looks like Google Fonts API key is invalid on unyson cache site. Tried to generate my own api key and change url directly to google, but it looks like the old response is saved in some kind of cache. Idea how to clear the cache?

IamOri avatar Aug 22 '22 13:08 IamOri

Hi! same issue... do you found a solution?

tikyta avatar Aug 22 '22 15:08 tikyta

Same issue here : Warning: Invalid argument supplied for foreach() in /home/customer/www/nebseo.com/public_html/wp-content/plugins/unyson/framework/includes/option-types/typography-v2/class-fw-option-type-typography-v2.php on line 148

Nebseo avatar Aug 22 '22 15:08 Nebseo

I share the solution that worked for me...

Added an "array" to the line 148..

public function get_google_font( $font ) { $fonts = $this->get_fonts();

foreach ( (array)  $fonts['google']['items'] as $g_font ) {
	if ( $font === $g_font['family'] ) {
		return $g_font;
	}
}

return false;

}

tikyta avatar Aug 22 '22 17:08 tikyta

I share the solution that worked for me...

Added an "array" to the line 148..

public function get_google_font( $font ) { $fonts = $this->get_fonts();

foreach ( (array)  $fonts['google']['items'] as $g_font ) {
	if ( $font === $g_font['family'] ) {
		return $g_font;
	}
}

return false;

}

I've tried it and it works for me too!!!

Thanks @tikyta

Nebseo avatar Aug 22 '22 18:08 Nebseo

@tikyta for me it's always there image

Tom2710 avatar Aug 23 '22 06:08 Tom2710

I share the solution that worked for me...

Added an "array" to the line 148..

public function get_google_font( $font ) { $fonts = $this->get_fonts();

foreach ( (array)  $fonts['google']['items'] as $g_font ) {
	if ( $font === $g_font['family'] ) {
		return $g_font;
	}
}

return false;

}

I belive it just force variable to convert to array, so u dont get error, but fonts are still not loaded.

IamOri avatar Aug 23 '22 10:08 IamOri

Probably best solution, since unyson cache site seems to be back online. Unyson is saving fonts data in database for 7 days and loads them from their own site, so it cached wrong data when the site was down.

Delete cached fonts data in your database: in table "wp_options" find row with "option_name"="fw_google_fonts" and update/delete value in "option_value" column to be empty string.

Or use this command and replace {{YOUR_DATABASE_NAME}} with your wp database name:

UPDATE {{YOUR_DATABASE_NAME}}.wp_options SET option_value='' WHERE option_name="fw_google_fonts";

After updating db reload your page twice.(Probably best if you turn off all cache plugins before that).

First reload you will get errors like this, because script expects some arrays and values we deleted: Warning: Illegal string offset 'last_update' in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309 Warning: A non-numeric value encountered in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309

But it will also load new data into db, so next time there should be no errors.

IamOri avatar Aug 23 '22 11:08 IamOri

Probably best solution, since unyson cache site seems to be back online. Unyson is saving fonts data in database for 7 days and loads them from their own site, so it cached wrong data when the site was down.

Delete cached fonts data in your database: in table "wp_options" find row with "option_name"="fw_google_fonts" and update/delete value in "option_value" column to be empty string.

Or use this command and replace {{YOUR_DATABASE_NAME}} with your wp database name:

UPDATE {{YOUR_DATABASE_NAME}}.wp_options SET option_value='' WHERE option_name="fw_google_fonts";

After updating db reload your page twice.(Probably best if you turn off all cache plugins before that).

First reload you will get errors like this, because script expects some arrays and values we deleted: Warning: Illegal string offset 'last_update' in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309 Warning: A non-numeric value encountered in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309

But it will also load new data into db, so next time there should be no errors.

My problem is that I can't find "wp_options". It is just not there!

jls556 avatar Aug 24 '22 06:08 jls556

My problem is that I can't find "wp_options". It is just not there!

Maybe you have different prefix for wordpress tables? I think all tables that are created by wp should have the same prefix. Try to look for tables that have common prefix with others. (xyz_options, myCustomPrefix_options, ...) Not sure if its possible to have no prefix. If thats the case, it would be just "options" or "_options".

IamOri avatar Aug 24 '22 07:08 IamOri

@IamOri Thanks. But I didn't change or set up any other prefix. I have a lot of files and folders with "wp" but no options. If I search for it, no result. I found 1 file, not the content I'd expected.

jls556 avatar Aug 24 '22 13:08 jls556

@jls556 Oh.. you need to login to your database and edit database, not script files. If you are on web hosting, usually there is phpMyAdmin portal that you can use to access your database. If you have site on VPS or other self administered server, you will have to login to your server and use comandline utility or install phpMyAdmin, or use some other client.

IamOri avatar Aug 24 '22 13:08 IamOri

Worked! Thank you.

jls556 avatar Aug 24 '22 15:08 jls556

Probably best solution, since unyson cache site seems to be back online. Unyson is saving fonts data in database for 7 days and loads them from their own site, so it cached wrong data when the site was down.

Delete cached fonts data in your database: in table "wp_options" find row with "option_name"="fw_google_fonts" and update/delete value in "option_value" column to be empty string.

Or use this command and replace {{YOUR_DATABASE_NAME}} with your wp database name:

UPDATE {{YOUR_DATABASE_NAME}}.wp_options SET option_value='' WHERE option_name="fw_google_fonts";

After updating db reload your page twice.(Probably best if you turn off all cache plugins before that).

First reload you will get errors like this, because script expects some arrays and values we deleted: Warning: Illegal string offset 'last_update' in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309 Warning: A non-numeric value encountered in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309

But it will also load new data into db, so next time there should be no errors.

THANK YOU SO MUCH, @IamOri! Such a quick and simple solution, but I never would have thought of it on my own. Fixed the issue for me, even though my error was the /unyson/framework/helpers/general.php error and not the /unyson/framework/includes/option-types/typography...etc error. Thank you thank you thank you!!!

yourwebchick avatar Aug 25 '22 01:08 yourwebchick

I can't find that fw_google_fonts in my datable wp-options table

odofincaleb avatar Aug 26 '22 16:08 odofincaleb

image This is my database wp-options with options_name arranged alphabetically

odofincaleb avatar Aug 26 '22 16:08 odofincaleb

Found it table=sgqepm_options

and it worked.

Please Note I was looking here , wp-options table image

But i found it here sgqepm_options image

odofincaleb avatar Aug 26 '22 16:08 odofincaleb

Probably best solution, since unyson cache site seems to be back online. Unyson is saving fonts data in database for 7 days and loads them from their own site, so it cached wrong data when the site was down.

Delete cached fonts data in your database: in table "wp_options" find row with "option_name"="fw_google_fonts" and update/delete value in "option_value" column to be empty string.

Or use this command and replace {{YOUR_DATABASE_NAME}} with your wp database name:

UPDATE {{YOUR_DATABASE_NAME}}.wp_options SET option_value='' WHERE option_name="fw_google_fonts";

After updating db reload your page twice.(Probably best if you turn off all cache plugins before that).

First reload you will get errors like this, because script expects some arrays and values we deleted: Warning: Illegal string offset 'last_update' in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309 Warning: A non-numeric value encountered in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309

But it will also load new data into db, so next time there should be no errors.

Thank you for helping me solve the issue

odofincaleb avatar Aug 26 '22 16:08 odofincaleb

This happens because 'unyson.io' domain was not payed at some moment of time and fonts list in the JSON format was not saved in the wp_options in the option key called 'fw_google_fonts'.

If you have this error or if your Customizer options are disappeared, you can try to add this code into your 'functions.php' file.

add_action( 'wp', function () {
    $fonts = get_option( 'fw_google_fonts', false );
    if (
        is_array( $fonts )
        &&
        ! empty( $fonts['fonts'] )
        &&
        false !== stripos( $fonts['fonts'], '<!DOCTYPE html>' )
    ) {
        update_option( 'fw_google_fonts', '' );
    }
});

then just reload your page. Problem should disappear. After that you can remove this code.

yura-x avatar Aug 26 '22 19:08 yura-x

Good job 👍 , same solution as mine, just doing it in code.

IamOri avatar Aug 26 '22 19:08 IamOri

Probably best solution, since unyson cache site seems to be back online. Unyson is saving fonts data in database for 7 days and loads them from their own site, so it cached wrong data when the site was down.

Delete cached fonts data in your database: in table "wp_options" find row with "option_name"="fw_google_fonts" and update/delete value in "option_value" column to be empty string.

Or use this command and replace {{YOUR_DATABASE_NAME}} with your wp database name:

UPDATE {{YOUR_DATABASE_NAME}}.wp_options SET option_value='' WHERE option_name="fw_google_fonts";

After updating db reload your page twice.(Probably best if you turn off all cache plugins before that).

First reload you will get errors like this, because script expects some arrays and values we deleted: Warning: Illegal string offset 'last_update' in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309 Warning: A non-numeric value encountered in {{hosting_root}}/wp-content/plugins/unyson/framework/helpers/general.php on line 1309

But it will also load new data into db, so next time there should be no errors.

Hey @IamOri,

I've tried to clear the fw_google_fonts, but the option_value is already cleared. I'm only getting this when putting up a stage or pushing a stage to live

image image

joossii avatar Aug 30 '22 07:08 joossii

@joossii Hi, this general error message can mean anything. Plugin should populate fw_google_fonts automaticaly when its needed. So i guess its not really related to this issue. I suggest trying to get more specific informations about whats going on and create new issue.

IamOri avatar Aug 30 '22 08:08 IamOri

@joossii Hi, this general error message can mean anything. Plugin should populate fw_google_fonts automaticaly when its needed. So i guess its not really related to this issue. I suggest trying to get more specific informations about whats going on and create new issue.

It looks like when I set the empty string the plug in is not updating the value. How to force it or do you have a strick which I can paste there maybe to check if it will solve the problem?

PioPas avatar Dec 11 '22 22:12 PioPas

@joossii Hi, this general error message can mean anything. Plugin should populate fw_google_fonts automaticaly when its needed. So i guess its not really related to this issue. I suggest trying to get more specific informations about whats going on and create new issue.

It looks like when I set the empty string the plug in is not updating the value. How to force it or do you have a strick which I can paste there maybe to check if it will solve the problem?

I managed to get it update but I have now this: a:2:{s:11:"last_update";i:1670799466;s:5:"fonts";s:39:"Error : Failed to get Google Fonts list";}

PioPas avatar Dec 11 '22 23:12 PioPas