• Resolved Malae

    (@malae)


    Hello,

    I posted the following 9 months ago:

    Apparently since recent WordPress updates the plugin is producing a notice:
    `PHP Notice: Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.) in /srv/http/wordpress/freehostingreviews/wp-includes/functions.php on line 5831′
    This causes the display of a link: Debugging in WordPress to be displayed at the top of the page. If the plugin is deactivated the link disappears.

    I never received a reply. The WordPress page for this plugin has a link:
    For faster support please contact us here.
    If this is clicked it opens the plugin page with an email form, but this immediately disappears if the page is scrolled.

    This is the current message in the debug.log file:
    PHP Notice: Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.) in /home/u440861037/public_html/fwhr/wp-includes/functions.php on line 5835

    Only when the Easy Social Icons plugin is activated, this message floods the debug.log file and is a nuisance when debugging other code.

    Is this plugin abandonded?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Ov3rfly

    (@ov3rfly)

    Found the same problem on a client website.

    In easy-social-icons.php there are three wpdb::prepare() which have no % placeholder in query and trigger these notices.

    We fixed it by using the SQL directly, which is fine in these cases as there is actually nothing to prepare.

    line 124:
    
    //$sql = $wpdb->prepare("SELECT id, title, url, image_url, sortorder, target FROM {$table_name} WHERE url != '' AND image_url != '' ORDER BY sortorder");
    
    $sql = "SELECT id, title, url, image_url, sortorder, target FROM {$table_name} WHERE url != '' AND image_url != '' ORDER BY sortorder";
    
    line 1177:
    
    //$sql = $wpdb->prepare("SELECT * FROM {$table_name} WHERE image_url != '' AND url != '' ORDER BY sortorder");
    
    $sql = "SELECT * FROM {$table_name} WHERE image_url != '' AND url != '' ORDER BY sortorder";
    
    line 1255:
    
    //$sql = $wpdb->prepare("SELECT * FROM {$table_name} WHERE image_url != '' AND url != '' $where_sql ORDER BY sortorder");
    
    $sql = "SELECT * FROM {$table_name} WHERE image_url != '' AND url != '' $where_sql ORDER BY sortorder";

    Note: Variable $where_sql in line 1255 is “prepared” before in line 1236.

    There is also another small issue which we found and fixed. The “Title” is escaped wrong before insert/update.

    lines 597 and 664:
    
    //'title' => sanitize_title($_POST['title']),
    'title' => sanitize_text_field($_POST['title']),

    Easy Social Icons 3.2.4

    Thread Starter Malae

    (@malae)

    Hello Ov3rfly,

    Thank you for your very helpful response. I had identified the instances of wpdb::prepare() in the easy-social-icons.php, but did not have time to determine the fix required and had switched to another plugin. I applied the code you provided, all is now well and I have reinstated the plugin.

    @cybernetikz I experienced the same problem, and it looks like you just have to use this provided code to solve this. Can you please release a version with a fix? Thank you!

    Thread Starter Malae

    (@malae)

    Hello Ov3rfly,

    Have you come accross the issue that I posted a couple of months ago?

    Warning (Suppressed) mkdir(): Permission denied
    wp-includes/functions.php:2057
    mkdir()
    wp-includes/functions.php:2057
    wp_mkdir_p() wp-includes/functions.php:2368
    wp_upload_dir()
    wp-content/plugins/easy-social-icons/easy-social-icons.php:14

    No.

    That warning seems unrelated to the plugin and points to a more general problem within wp_upload_dir() caused by your uploads folder structure/permissions.

    Thread Starter Malae

    (@malae)

    Hello Ov3rfly,
    Thanks for your reply. I am only getting the error when this plugin is activated. I have checked all the permissions and couldn’t find anything that was causing the error.

    Plugin Author CyberNetikz

    (@cybernetikz)

    hello,

    this sql prepare issue is fixed in version 3.2.5

    thanks to @ov3rfly

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin causing display of “Debugging in WordPress ” link on page’ is closed to new replies.