• Resolved opicron

    (@opicron)


    The following error is piling up in my error logs of Apache and it is causing my ecommerce site to not function. Rolling back now.

    ‘PHP message: PHP Parse error: syntax error, unexpected ‘)’ in /var/www/html/wp-content/plugins/wplr-sync/classes/rest.php on line 371\n’

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @opicron,

    Strange, I looked at the code, but I don’t know why that exact line would cause an error.

    Would you mind looking at that file and pasting that line? (and maybe a few lines around it too)

    That will be fixed, in a way or another, syntax errors are easy to fix.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Which version of PHP are you running?

    Thread Starter opicron

    (@opicron)

    PHP:

    PHP Version 7.2.34-9+ubuntu18.04.1+deb.sury.org+1

    Code line 360-373:

    $results = $wpdb->get_results(
    			$wpdb->prepare(
    				"SELECT p.ID, p.post_title, p.post_content as description, p.post_excerpt as caption, pm1.meta_value as alt, pm2.meta_value as path 
    				FROM $wpdb->posts p 
    				LEFT JOIN $wpdb->postmeta pm1 ON pm1.post_id = p.ID AND pm1.meta_key = '_wp_attachment_image_alt' 
    				LEFT JOIN $wpdb->postmeta pm2 ON pm2.post_id = p.ID AND pm2.meta_key = '_wp_attached_file' 
    				WHERE post_type='attachment' 
    				AND post_status='inherit' 
    				AND ID IN (" . $mediaIdsPlaceholders . ") 
    				$orderSql 
    				LIMIT %d, %d", array_merge($mediaIds, [$skip, $limit] ),
    			), ARRAY_A
    		);

    Also no other errors appear in the error logs. Only the one mentioned in OP.

    Same problem here after the update to
    Photo Engine (WP/LR Sync) 6.0.5
    WP/LR Theme Assistant 0.5.4

    I’m also running PHP 7.2.24-0ubuntu0.18.04.7. Yes, I do know that an update is due … ??

    For the time being I had to disable both plugins to be able to use the WP backend again.

    Thanks for looking into this.

    Error log:

    [Sat Jun 05 18:24:44.440425 2021] [php7:emerg] [pid 9065] [client 91.37.181.4:57744] PHP Parse error:  syntax error, unexpected ')' in /var/www-server/photo/blog/wp-content/plugins/wplr-sync/classes/rest.php on line 371, referer: https://xxx/blog/wp-admin/admin.php?page=wplr_sync_settings
    [Sat Jun 05 18:25:48.014455 2021] [php7:emerg] [pid 11779] [client 91.37.181.4:57760] PHP Parse error:  syntax error, unexpected ')' in /var/www-server/photo/blog/wp-content/plugins/wplr-sync/classes/rest.php on line 371, referer: https://xxx/blog/wp-admin/admin.php?page=wplr_sync_settings
    [Sat Jun 05 18:26:43.048223 2021] [php7:error] [pid 12229] [client 91.37.181.4:57764] PHP Fatal error:  Uncaught Error: Call to a member function get_meta_from_value() on null in /var/www-server/photo/blog/wp-content/plugins/wplr-theme-assistant/wplr-theme-assistant.php:97\nStack trace:\n#0 /var/www-server/photo/blog/wp-includes/class-wp-hook.php(292): WPLR_Theme_Assistant->manage_posts_custom_column('WPLRSync_PostTy...', 2)\n#1 /var/www-server/photo/blog/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array)\n#2 /var/www-server/photo/blog/wp-includes/plugin.php(484): WP_Hook->do_action(Array)\n#3 /var/www-server/photo/blog/wp-admin/includes/class-wp-posts-list-table.php(1255): do_action('manage_pages_cu...', 'WPLRSync_PostTy...', 2)\n#4 /var/www-server/photo/blog/wp-admin/includes/class-wp-list-table.php(1447): WP_Posts_List_Table->column_default(Object(WP_Post), 'WPLRSync_PostTy...')\n#5 /var/www-server/photo/blog/wp-admin/includes/class-wp-posts-list-table.php(1315): WP_List_Table->single_row_columns(Object(WP_Post))\n#6 /var/www-server/photo/blog/wp-admin/includes/class-wp-posts-list-table.php(852):  in /var/www-server/photo/blog/wp-content/plugins/wplr-theme-assistant/wplr-theme-assistant.php on line 97, referer: https://xxx/blog/wp-admin/plugins.php?plugin_status=all&paged=1&s

    @tigroumeow any news here? Otherwise I have to roll back to the previous version.
    Thx.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Yes, I was working on a new version, and I just released a few minutes ago. Can you try it? ??

    I worked on this issue too, I was replying to some customers.

    Just updated to 6.0.6, but still creates problems with the backend:

    [php7:emerg] [pid 28054] [client 79.233.52.72:53544] PHP Parse error: syntax error, unexpected ‘)’ in /var/www-server/photo/blog/wp-content/plugins/wplr-sync/classes/rest.php on line 374

    Thread Starter opicron

    (@opicron)

    It only happens on other rest api calls. Not during regular usage of the website.

    Rolled back to 5.1.8 for now as I needed to upload images to my website.

    Plugin Author Jordy Meow

    (@tigroumeow)

    There is mystery here, guys; in fact, this issue is only experienced by a tiny percentage of my users (like 0.05%). It’s about the syntax, so it should be really easy to fix; but looking at the code, I really don’t see anything wrong at all.

    Have you tried modifying the code?

    Can you confirm that the code making this issue is this part?

    $wpdb->prepare(
        "SELECT p.ID, p.post_title, p.post_content as description, p.post_excerpt as caption, pm1.meta_value as alt, pm2.meta_value as path 
        FROM $wpdb->posts p 
        LEFT JOIN $wpdb->postmeta pm1 ON pm1.post_id = p.ID AND pm1.meta_key = '_wp_attachment_image_alt' 
        LEFT JOIN $wpdb->postmeta pm2 ON pm2.post_id = p.ID AND pm2.meta_key = '_wp_attached_file' 
        WHERE post_type='attachment' 
        AND post_status='inherit' 
        AND ID IN (" . $mediaIdsPlaceholders . ") 
        $orderSql 
        LIMIT %d, %d", array_merge( $mediaIds, array( $skip, $limit ) ),
      ), ARRAY_A
    );

    Do you see anyway to change this so that it works for you? I feel blind, is there something I don’t see?

    Are you all running PHP 7.2? I actually could only test this with 5.6, 7.3, 7.4 and 8.0.

    I also looked all over the web for similar issues and I found this: https://www.ads-software.com/support/topic/syntax-error-php-7-2/. And it was you @opicron ??

    Oh wait, maybe it’s this… what happens if you remove the comma at the end of this line?

    array_merge( $mediaIds, array( $skip, $limit ) ),

    Normally, that’s completely fine, but this specific version of PHP with some settings might break on it.

    Creato

    (@creatomatic)

    @tigroumeow

    I had to fix this for a customer this morning as it breaks REST. You have a comma after array_merge() but there are no further arguments.

    Best wishes,

    James

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    I pushed a new release, it also fixes this permanently ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Error in Apache logs’ is closed to new replies.