ThemeFuse / Unyson

A WordPress framework that facilitates the development of WP themes
http://unyson.io
923 stars 219 forks source link

Warning: Invalid argument supplied for foreach() in plugins/unyson/framework/helpers/general.php on line 1275 #4259

Open hindalf opened 1 year ago

hindalf commented 1 year ago

This bug just occured on our website zmenaprohradec.cz. I cant find any solution to this. Could you please help me?

IamOri commented 1 year ago

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?

amiesass commented 1 year ago

I have the same issue but don't know if it has to do with Google fonts or not... did you get this to resolve? See the error here: https://customerloyaltyaccelerator.com/

yaraswidan commented 1 year ago

Same Issue Here mine is Warning: Invalid argument supplied for foreach() in /home/harvestc/public_html/wp-content/plugins/unyson/framework/includes/option-types/typography-v2/class-fw-option-type-typography-v2.php on line 148

jaysav22 commented 1 year ago

Any update on how to fix this issue?

UsmonjonN commented 1 year ago

Any updates?

nafisaakabor commented 1 year ago

Hi there. Same issue on my site. Cannot access the font area either to change it. Looks hideous. When will there be a fix? Thanks

EDIT: I rolled back to a back up from a few days ago for what I think is a temporary fix.

jls556 commented 1 year ago

Same error on my website as well! I am not sure if I can/should use a backup of a certain plugin or the whole page.

Anybody who can help? Looks pretty shitty on a business website.

hindalf commented 1 year ago

Ok, I have some advice. It is not the solution and it is pretty shitty advice. I needed to hide the warning at least and this works so far. Go to /framework/helpers/general.php and delete rows from 1262 to 1292. The warning is gone and any new bugs did not occur.

IamOri commented 1 year ago

Hello my solution: https://github.com/ThemeFuse/Unyson/issues/4261#issuecomment-1223924349

IamOri commented 1 year ago

Ok, I have some advice. It is not the solution and it is pretty shitty advice. I needed to hide the warning at least and this works so far. Go to /framework/helpers/general.php and delete rows from 1262 to 1292. The warning is gone and any new bugs did not occur.

Yeah not a good idea :-D, i guess plugin will have problems to load fonts. Better would be hide error reporting by adding this to the top of your index.php (after <?php tag)

ini_set('display_errors', 0); ini_set('display_startup_errors', 0); error_reporting(0);

hindalf commented 1 year ago

Ok, I have some advice. It is not the solution and it is pretty shitty advice. I needed to hide the warning at least and this works so far. Go to /framework/helpers/general.php and delete rows from 1262 to 1292. The warning is gone and any new bugs did not occur.

Yeah not a good idea :-D, i guess plugin will have problems to load fonts. Better would be hide error reporting by adding this to the top of your index.php (after <?php tag)

ini_set('display_errors', 0); ini_set('display_startup_errors', 0); error_reporting(0);

Hard times require hard measures. :-) I will use your real solution. Looks much better :-) Thanks!

jaysav22 commented 1 year ago

This solution will make the error go away, but fonts will still not be loaded. Just need to add an (array) to this section in your code.

foreach ( (array) $g_fonts['items'] as $font ) { $fonts[ $font['family'] ] = array( 'family' => $font['family'], 'variants' => $font['variants'], 'position' => isset( $old_fonts[ $font['family'] ] ) ? $old_fonts[ $font['family'] ]['position'] : 99999 );

No more errors on my website.

IamOri commented 1 year ago

This solution will make the error go away, but fonts will still not be loaded. Just need to add an (array) to this section in your code.

foreach ( (array) $g_fonts['items'] as $font ) { $fonts[ $font['family'] ] = array( 'family' => $font['family'], 'variants' => $font['variants'], 'position' => isset( $old_fonts[ $font['family'] ] ) ? $old_fonts[ $font['family'] ]['position'] : 99999 );

No more errors on my website.

Real solution https://github.com/ThemeFuse/Unyson/issues/4261#issuecomment-1223924349