Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

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

Open hindalf opened this issue 2 years ago • 13 comments

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

hindalf avatar Aug 22 '22 08:08 hindalf

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

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/

amiesass avatar Aug 22 '22 15:08 amiesass

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

yaraswidan avatar Aug 22 '22 16:08 yaraswidan

Any update on how to fix this issue?

jaysav22 avatar Aug 22 '22 23:08 jaysav22

Any updates?

UsmonjonN avatar Aug 23 '22 06:08 UsmonjonN

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.

nafisaakabor avatar Aug 23 '22 07:08 nafisaakabor

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.

jls556 avatar Aug 23 '22 11:08 jls556

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.

hindalf avatar Aug 23 '22 11:08 hindalf

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

IamOri avatar Aug 23 '22 11:08 IamOri

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);

IamOri avatar Aug 23 '22 11:08 IamOri

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!

hindalf avatar Aug 23 '22 11:08 hindalf

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.

jaysav22 avatar Aug 23 '22 13:08 jaysav22

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

IamOri avatar Aug 23 '22 15:08 IamOri