• Hi,

    My website has been working fine, however I had to upgrade my PHP version from 5.6.40 to 7.3.33 and now I’m getting some errors on my WordPress admin backend, more specifically on my Widgets page, which is not working.

    I have some Warnings on top of the page, such as:

    Warning: strpos() expects parameter 1 to be string, array given in /home/customer/www/XXXXX.com/public_html/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 783
    
    Warning: substr() expects parameter 1 to be string, array given in /home/customer/www/XXXXX.com/public_html/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 784
    
    Warning: strpos(): Offset not contained in string in /home/customer/www/XXXXX.com/public_html/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 783
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/XXXXX.com/public_html/wp-content/plugins/qtranslate-x/admin/qtx_admin.php:783) in /home/customer/www/XXXXX.com/public_html/wp-admin/admin-header.php on line 9

    I also have some messages informing that none of the widgets will work, most likely because of that. Here are some:

    `The “custom_html” block was affected by errors and may not function properly. Check the developer tools for more details.

    The “recent-posts” block was affected by errors and may not function properly. Check the developer tools for more details.

    The “nav_menu” block was affected by errors and may not function properly. Check the developer tools for more details.

    The “gmap” block was affected by errors and may not function properly. Check the developer tools for more details.

    The “social” block was affected by errors and may not function properly. Check the developer tools for more details.

    The “contact_form” block was affected by errors and may not function properly. Check the developer tools for more details.

    From what I’ve been investigating the function strpos() has changed in the latest PHP versions, and one of the parameters is not used anymore, that’s why this isn’t working. Any ideas to help me solve this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • here is a dirty fix, wrap the first param in a strval().
    the new 783 and 784 lines should become as following:

    
    while(($p = strpos(strval($args['name']),'&',$p)) !== false){
    if(substr(strval($args['name']),$p,5) == '&'){
    

    good luck

    Hi thanks @buondioz,
    i just updated to WordPress 6.0 and got the following warning:

    parameter 1 to be string, array given in /homepages/35/d589757210/htdocs/clickandbuilds/WordPress/MyCMS2/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 783
    
    Warning: substr() expects parameter 1 to be string, array given in /homepages/35/d589757210/htdocs/clickandbuilds/WordPress/MyCMS2/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 784
    
    Warning: substr() expects parameter 1 to be string, array given in /homepages/35/d589757210/htdocs/clickandbuilds/WordPress/MyCMS2/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 788
    
    Warning: substr() expects parameter 1 to be string, array given in /homepages/35/d589757210/htdocs/clickandbuilds/WordPress/MyCMS2/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 788
    
    Warning: strpos(): Offset not contained in string in /homepages/35/d589757210/htdocs/clickandbuilds/WordPress/MyCMS2/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 783

    any ideas? As i deactivated the plugin my Website got a “fatal error”.

    Thanks

    @woulier you can use the same fix I posted above editing the file /wp-content/plugins/qtranslate-x/admin/qtx_admin.php and replace lines 783 and 784 with:

    while(($p = strpos(strval($args['name']),'&',$p)) !== false){
    if(substr(strval($args['name']),$p,5) == '&'){

    thanks @buondioz it worked well :))

    I have a problem! Im my site, this errors are appear in admin, but the site is working well! Someone knows how to fix that? Thanks a lot!

    parameter 1 to be string, array given in /home/unih/public_html/site/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 783
    
    Warning: substr() expects parameter 1 to be string, array given in /home/unih/public_html/site/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 784
    
    Warning: substr() expects parameter 1 to be string, array given in /home/unih/public_html/site/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 788
    
    Warning: substr() expects parameter 1 to be string, array given in /home/unih/public_html/site/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 788
    
    Warning: strpos(): Offset not contained in string in /home/unih/public_html/site/wp-content/plugins/qtranslate-x/admin/qtx_admin.php on line 783

    Thank you @buondioz – your solution worked for me as well! Great!

    Thanks buondioz (@buondioz) and your solution works perfect !
    Very much appreciated and thank you again.

    Hello guys,

    I’m getting this errors on my webpage when qtranslate is active.

    Fatal error: Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in C:\xampp\htdocs\kqz\wp-content\plugins\qtranslate1\admin\qtx_admin.php:783 Stack trace: #0 C:\xampp\htdocs\kqz\wp-content\plugins\qtranslate1\admin\qtx_admin.php(783): strpos(Array, '&', 0) #1 C:\xampp\htdocs\kqz\wp-includes\class-wp-hook.php(307): qtranxf_get_terms_args(Array, Array) #2 C:\xampp\htdocs\kqz\wp-includes\plugin.php(191): WP_Hook->apply_filters(Array, Array) #3 C:\xampp\htdocs\kqz\wp-includes\class-wp-term-query.php(407): apply_filters('get_terms_args', Array, Array) #4 C:\xampp\htdocs\kqz\wp-includes\class-wp-term-query.php(307): WP_Term_Query->get_terms() #5 C:\xampp\htdocs\kqz\wp-includes\class-wp-tax-query.php(645): WP_Term_Query->query(Array) #6 C:\xampp\htdocs\kqz\wp-includes\class-wp-tax-query.php(580): WP_Tax_Query->transform_query(Array, 'term_taxonomy_i...') #7 C:\xampp\htdocs\kqz\wp-includes\class-wp-tax-query.php(394): WP_Tax_Query->clean_query(Array) #8 C:\xampp\htdocs\kqz\wp-includes\class-wp-tax-query.php(324): WP_Tax_Query->get_sql_for_clause(Array, Array) #9 C:\xampp\htdocs\kqz\wp-includes\class-wp-tax-query.php(274): WP_Tax_Query->get_sql_for_query(Array) #10 C:\xampp\htdocs\kqz\wp-includes\class-wp-tax-query.php(250): WP_Tax_Query->get_sql_clauses() #11 C:\xampp\htdocs\kqz\wp-includes\class-wp-query.php(2159): WP_Tax_Query->get_sql('wp_posts', 'ID') #12 C:\xampp\htdocs\kqz\wp-includes\class-wp-query.php(3586): WP_Query->get_posts() #13 C:\xampp\htdocs\kqz\wp-includes\post.php(2410): WP_Query->query(Array) #14 C:\xampp\htdocs\kqz\wp-includes\post.php(3939): get_posts(Array) #15 C:\xampp\htdocs\kqz\wp-includes\class-wp-theme-json-resolver.php(285): wp_get_recent_posts(Array) #16 C:\xampp\htdocs\kqz\wp-includes\class-wp-theme-json-resolver.php(323): WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles(Object(WP_Theme)) #17 C:\xampp\htdocs\kqz\wp-includes\class-wp-theme-json-resolver.php(387): WP_Theme_JSON_Resolver::get_user_data() #18 C:\xampp\htdocs\kqz\wp-includes\script-loader.php(3076): WP_Theme_JSON_Resolver::get_merged_data() #19 
    C:\xampp\htdocs\kqz\wp-includes\script-loader.php(3272): {closure}() #20 
    C:\xampp\htdocs\kqz\wp-includes\class-wp-hook.php(307): {closure}('') #21 C:\xampp\htdocs\kqz\wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #22 C:\xampp\htdocs\kqz\wp-includes\plugin.php(476): WP_Hook->do_action(Array) #23 C:\xampp\htdocs\kqz\wp-settings.php(620): do_action('wp_loaded') #24 C:\xampp\htdocs\kqz\wp-config.php(96): require_once('C:\\xampp\\htdocs...') #25 C:\xampp\htdocs\kqz\wp-load.php(50): require_once('C:\\xampp\\htdocs...') #26 C:\xampp\htdocs\kqz\wp-admin\admin.php(34): require_once('C:\\xampp\\htdocs...') #27 C:\xampp\htdocs\kqz\wp-admin\plugins.php(10): require_once('C:\\xampp\\htdocs...') #28 {main} thrown in C:\xampp\htdocs\kqz\wp-content\plugins\qtranslate1\admin\qtx_admin.php on line 783
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘PHP update issues’ is closed to new replies.