• Resolved Nauriskolats

    (@nauriskolats)


    Hi guys, just want to say you have an awesome plugin! πŸ™‚

    I have a small but annoying issue – it seems that after some of the recent updates every time the License is created / edited I’m getting this in my log file:

    PHP Notice: wpdb::prepare was called <strong>incorrectly</strong>. The query does not contain the correct number of placeholders (6) for the number of arguments passed (1). Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 4.8.3.) in /wp-includes/functions.php on line 5167

    Could you please take a look at what might be causing this notice and fix it?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, thank you for reaching out to us and reporting this issue. I have submitted a message to the developers to investigate further your issue.

    Thank you

    Plugin Author mra13

    (@mra13)

    It seems like a value is not being passed for one of the fields. Can you get more details as to which lien and which file or our plugin is involved? What I am seeing in your message is just a generic error that is hard to understand where it is coming from.

    When I create and edit license, I don’t see any error on my site. So knowing the line number and file would allow me to look at the code in a specific area and try to understand the cause.

    Thread Starter Nauriskolats

    (@nauriskolats)

    Hi guys, thanks for getting back.

    I started digging a bit deeper in the code and seems like the notice is actually thrown when using License “Search”.

    And this function is responsible for the notices: https://prnt.sc/susp6n
    It is located in the slm-list-licenses-class.php. It looks like as though

    $placeholder = '%%%1$s%%';
    			$data        = $wpdb->get_results(
    				$wpdb->prepare(
    					"SELECT <code>lk</code>.*, CONCAT( COUNT( <code>rd</code>.<code>lic_key_id</code> ), '/', <code>lk</code>.<code>max_allowed_domains</code> ) AS <code>max_allowed_domains</code> FROM <code>$license_table</code> <code>lk</code> LEFT JOIN <code>$domain_table</code> <code>rd</code> ON <code>lk</code>.<code>id</code> = <code>rd</code>.<code>lic_key_id</code> WHERE <code>lk</code>.<code>license_key</code> LIKE '$placeholder' OR <code>lk</code>.<code>email</code> LIKE '$placeholder' OR <code>lk</code>.<code>txn_id</code> LIKE '$placeholder' OR <code>lk</code>.<code>first_name</code> LIKE '$placeholder' OR <code>lk</code>.<code>last_name</code> LIKE '$placeholder' OR <code>rd</code>.<code>registered_domain</code> LIKE '$placeholder' GROUP BY <code>lk</code>.<code>id</code> ORDER BY $orderby $order",
    					$search_term
    				),
    				ARRAY_A
    			);
    Plugin Author mra13

    (@mra13)

    Thank you. We have released an update to address this. When you upgrade to the new version 4.4.2, you shouldn’t see this issue anymore.

    Thread Starter Nauriskolats

    (@nauriskolats)

    Awesome, tested it and it has been solved now. Thank you for such a quick fix! πŸ™‚

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wpdb::prepare was called incorrectly’ is closed to new replies.