• Resolved ultcrt

    (@ultcrt)


    The error log indicates that sprintf need 3 args but only 2 is given ( at 971 line of astra/inc/core/common_functions.php: ).

    I took a look at the code, it seems that astra_get_option( 'section-search-page-title-custom-title' ) contains %s already, but a redundant %s is appended to the variable title after astra_get_option( 'section-search-page-title-custom-title' ).

    After deleting the redundant %s , the error disappear.

    I think it could be a bug or am I doing something wrong? Maybe I messed up some settings in Astra?

    • This topic was modified 12 months ago by ultcrt.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @ultcrt,

    Could you please share with us the exact steps to replicate this? I will try it to reproduce it on my end.

    I look forward to hearing from you.

    Kind regards,
    Herman ??

    Thread Starter ultcrt

    (@ultcrt)

    Thanks for reply.

    The only thing I did is adding a search element in header, and use it to search something, then the searching page shows fatal error.

    Hi @ultcrt,

    What PHP version do you have? If you are using v8.3, please downgrade it to v8.2 or even v8.1.

    And just in case, please try disabling all of the plugins installed on your site and see if you still face the issue.

    I look forward to hearing from you.

    Kind regards,
    Herman ??

    Thread Starter ultcrt

    (@ultcrt)

    Sorry for my late reply.

    I am using PHP8.3. And I have disable all plugins. But I think PHP version and plugins are not responsible for the problem, because I recently found out the site language is the cause of the problem. If I set language back to English, the problem disappear. But if I set it to Chinese for example, the problem shows up.

    Thread Starter ultcrt

    (@ultcrt)

    After some digging, I believe there is a translation bug in the localization file astra-zh_CN.po at line 5378:

    #: inc/core/class-astra-theme-options.php:188
    msgid "Search Results for:"
    msgstr "“%s”的搜索结果"

    As you can see, the translated version has %s in it while the English version does not, which makes astra option section-search-page-title-custom-title has one more %s in translated version than English version , and this is why the error occurs.

    For now, I fix the problem using Astra child theme to avoid changing Astra main theme. Just put following code into functions.php:

    add_filter( 'astra_theme_defaults', 'fix_search_title' ); 
    function fix_search_title($defaults) {
    	$defaults['section-search-page-title-custom-title'] = '<Search title in your language>:';
       return $defaults;
    }

    Hope you guys could fix this translation problem in the future.

    Thank you

    • This reply was modified 11 months, 1 week ago by ultcrt.
    • This reply was modified 11 months, 1 week ago by ultcrt.

    Hi @ultcrt,

    I am able to replicate the issue on my end. I have reported this to our team. Thank you for bringing this to our attention and we are sorry for the inconvenience you may have because of this.

    Kind regards,
    Herman ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal error when searching’ is closed to new replies.