• Resolved Gal Baras

    (@galbaras)


    The following error occurred on several of my sites when I clicked the Save & Optimize button or the Refresh Cache (and maintain settings) link.

    [07-Dec-2022 23:49:19 UTC] PHP Fatal error:  Uncaught ArgumentCountError: array_intersect() expects at least 1 argument, 0 given in ROOT/wp-content/plugins/host-webfonts-local/includes/class-omgf.php:496
    Stack trace:
    #0 ROOT/wp-content/plugins/host-webfonts-local/includes/class-omgf.php(496): array_intersect()
    #1 ROOT/wp-content/plugins/host-webfonts-local/includes/optimize/class-run.php(111): OMGF::available_used_subsets()
    #2 ROOT/wp-content/plugins/host-webfonts-local/includes/optimize/class-run.php(50): OMGF_Optimize_Run->optimization_succeeded()
    #3 ROOT/wp-content/plugins/host-webfonts-local/includes/optimize/class-run.php(33): OMGF_Optimize_Run->run()
    #4 ROOT/wp-content/plugins/host-webfonts-local/includes/admin/class-optimize.php(89): OMGF_Optimize_Run->__construct()
    #5 ROOT/wp-content/plugins/host-webfonts-local/includes/admin/class-optimize.php(63): OMGF_Admin_Optimize->run()
    #6 ROOT/wp-content/plugins/host-webfonts-local/includes/admin/class-optimize.php(39): OMGF_Admin_Optimize->init()
    #7 ROOT/wp-content/plugins/host-webfonts-local/includes/class-omgf.php(239): OMGF_Admin_Optimize->__construct()
    #8 ROOT/wp-includes/class-wp-hook.php(308): OMGF->do_optimize()
    #9 ROOT/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    #10 ROOT/wp-includes/plugin.php(517): WP_Hook->do_action()
    #11 ROOT/wp-admin/admin.php(175): do_action()
    #12 ROOT/wp-admin/options-general.php(10): require_once('ROOT...')
    #13 {main}
      thrown in ROOT/wp-content/plugins/host-webfonts-local/includes/class-omgf.php on line 496

    It seems that this is related to having no Used Subset(s) selected on the Advanced Settings tab. Once a subset is selected and the cache directory is emptied, optimisation works.

    Looks like the update isn’t copying the existing subset selection into the new setting, and this causes the error. This is strange, because when the plugin is configured to perform automatic subset selection, that setting shouldn’t even be considered.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Hi Gal!

    Would you mind sharing a screenshot of the Optimize Local Fonts section?

    Also, which PHP version are you running?

    Thread Starter Gal Baras

    (@galbaras)

    I use PHP 8.0.

    Sample settings page: https://imgur.com/a/3pNVGHE – please note Google Maps is NOT used on this site. This is detected in the local business Schema markup, and shouldn’t be.

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Hi Gal,

    Thanks for the info. I’ve created this beta which should resolve your issue. Could you check and let me know?

    Thread Starter Gal Baras

    (@galbaras)

    Hi Daan,

    Tried this on a live site (the things I will do for you, ma’man). There was no error message initially, so I tried to clear the subset list to test further. After saving, instead of having no selections, it had Latin and Latin-ext selected.

    Subsequently optimising gave the notice “Latin-ext is removed as a Used Subset, as not all detected font families are available in this subset. Run optimization again to process these changes.”

    This time, the subset list only had Latin selected and optimisation proceeded with no issues.

    I think I’ve misinterpreted the meaning of “Auto-Configure Subsets”. The on-page explanations are “When this option is checked, OMGF will set the Used Subset(s) option to only use subsets that’re available for all detected font families”, and the advanced explanation for “Used Subsets” is “Any changes made to this setting will be overwritten, because Auto-configure Used Subsets is enabled. Disable it if you wish to manage Used Subset(s) yourself.”

    I read this to mean that when Auto-Configure is checked, the Used Subsets list will be ignored. Instead, the plugin configures it automatically.

    So selecting subsets automatically makes sense, although having to optimise twice may not be the best way to achieve this. It would be better to do a complete autoconfiguration and optimisation in one go when the list is empty.

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    After saving, instead of having no selections, it had Latin and Latin-ext selected.

    That’s correct. That’s the default value. As it covers the entire Western world, where 90% of my users are.

    Although having to optimise twice may not be the best way to achieve this

    Yes, I know. That’s how I intended it initially. Unfortunately it first needs to collect all fonts, and then save the value, and then run optimization again. Doing that all in one run will mean a lot of supprt tickets complaining about timeouts. ??

    Thread Starter Gal Baras

    (@galbaras)

    All good. Maybe mention this in the release notes (or did I miss it?)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘ArgumentCountError: array_intersect() expects at least 1 argument, 0 given’ is closed to new replies.