[wp-trac] [WordPress Trac] #42040: `$wpdb->prepare` returns blank without notice if less number of arguments are passed. should give a notice or exception

WordPress Trac noreply at wordpress.org
Mon Oct 2 02:10:41 UTC 2017


#42040: `$wpdb->prepare` returns blank without notice if less number of arguments
are passed. should give a notice or exception
--------------------------------------+---------------------
 Reporter:  thekt12                   |       Owner:  pento
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  4.9
Component:  Database                  |     Version:  4.8.2
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------

Comment (by pento):

 Thank you for your work on this bug, @thekt12!

 I've reworked your patch a bit, (with 4.9 coming up, I wanted to get it in
 as quickly as possible).

 The major changes I made were:

 * Change the `preg_match_all()` to only match valid placeholders, to avoid
 the counting loop.
 * Pass the error message through `__()`, and reword it so that we don't
 need plural variations.
 * Merge the individual tests into a single test with a `dataProvider`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42040#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list