Make WordPress Core


Ignore:
Timestamp:
02/02/2014 09:46:07 PM (13 years ago)
Author:
nacin
Message:

Throw an incorrect usage notice when the query argument of wpdb::prepare() does not include a placeholder.

props ounziw.
fixes #25604.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/db.php

    r27072 r27073  
    194194                return $modes;
    195195        }
     196
     197        /**
     198         * @ticket 25604
     199         * @expectedIncorrectUsage wpdb::prepare
     200         */
     201        function test_prepare_without_arguments() {
     202                global $wpdb;
     203                $id = 0;
     204                // This, obviously, is an incorrect prepare.
     205                $prepared = $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE id = $id", $id );
     206                $this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0", $prepared );
     207        }
    196208}
Note: See TracChangeset for help on using the changeset viewer.