• Resolved jkervran

    (@jkervran)


    Hi Loco team,

    We are getting a strange fatal error when using:

    – WordPress 6.0.2
    – PHP 8.0
    – WooCommerce 6.9.1
    – Loco Translate 2.6.2

    The error:

    PHP Fatal error: Uncaught ValueError: Unknown format specifier "a" in /home/rhum-attitude-audit.beapi.space/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php:96

    When deactivating Loco Translate, everything is back to normal.

    Would you know what is wrong here?

    Thanks in advance, best regards,

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Tim W

    (@timwhitlock)

    Uncaught ValueError: Unknown format specifier “a”

    You have a wrongly formatted translation value. Something like “%a” in your translation would be invalid and should probably be “%s” (or similar)

    This is explained in detail in the following FAQ: https://localise.biz/wordpress/plugin/faqs/printf-errors

    When deactivating Loco Translate, everything is back to normal.

    Presumably because the bad translation is not loaded without Loco Translate being active. This suggests it is in your own custom translations.

    Thread Starter jkervran

    (@jkervran)

    Hi Tim,

    Thank you for your reply!

    I look at each translation file manually and no “%a” is showing up.

    The incriminated line is this one:

    <span class="displaying-num"><?php echo esc_html( sprintf( _n( '%s item', '%s items', $variations_count, 'woocommerce' ), $variations_count ) ); ?></span>

    from: https://github.com/woocommerce/woocommerce/blob/1d4888768f4f56553ab951a5310cb9489de29257/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php#L96

    I could not see what is wrong here, any idea?…

    Thanks in advance, best regards,

    Jeremy Kervran for Be API

    • This reply was modified 2 years, 1 month ago by jkervran.
    Plugin Author Tim W

    (@timwhitlock)

    There is nothing wrong here. As explained – it’s a bad translation, not a bad bit of code.

    The “%a” is somewhere, because the error is telling you so. I can’t tell you where it is, except that it sounds like it’s in a custom translation file, as opposed to an installed one.

    Hello there,

    I have the same issue with php 8.1….

    Hello, same error here with php 8/8.1

    I need to disable the plugin to make it works.

    How to resolve this ?

    Here’s my error :


    WordPress version 6.1.1
    Extension actuelle?: WooCommerce (version 7.3.0)
    PHP version 8.1.11

    Uncaught ValueError: Unknown format specifier “a” in /public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php:106

    • This reply was modified 1 year, 10 months ago by Jean R..

    Hello,
    I have the same problem.
    I know it’s not the best solution but if you replace

    _n( '%s item', '%s items', $variations_count, 'woocommerce' )  

    with

    "%s articles"

    The product page with variations work fine. (My admin is in french).

    _n don’t return the good string. It must return the traduction “%s articles” but it return “% articles”.

    Hello,
    I have the same problem.
    I know it’s not the best solution but if you replace
    _n( '%s item', '%s items', $variations_count, 'woocommerce' )

    Thanks a lot, I could make variations work back in the admin.
    I don’t have any translation plugin, so I wonder what plugin (maybe the theme?) is interfering.

    Theme is Negan (last update from them is december 22), and everything is up-to-date.


    I don’t think the problem is the theme. I use another theme and i have the bug. What is your admin language ?

    I don’t think the problem is the theme. I use another theme and i have the bug. What is your admin language

    sorry for the late reply, didnt get any notification I believe.
    the admin is in french

    I specify that the variations worked for years, the bug is new (5/10 days ago)

    • This reply was modified 1 year, 6 months ago by rollyourz.

    Same for me, variations work for years.
    My admin is also in french.

    I have other website with woocommerce and variations with french admin and i don’t have this problem.
    Very strange.

    Hi I had the same problem and delete the “language” folder and re-download via updates solved the issue

    Merci Jean!

    One more thing, can you please be more precise with

    re-download via updates

    Thank you Jean, i test and it’s OK!

    @rollyourz you need to replace this file : /wp-content/languages/woocommerce/woocommerce-fr_FR.mo

    See this page : https://woocommerce.com/document/traduction-et-localisation-de-woocommerce/#section-3 (in french)

    Thank you Jean, i test and it’s OK!

    @rollyourz?you need to replace this file : /wp-content/languages/woocommerce/woocommerce-fr_FR.mo

    Ho NICE!!
    it’s working, thank you guys ??

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Fatal error with PHP 8 and WooCommerce’ is closed to new replies.