Make WordPress Core


Ignore:
Timestamp:
09/19/2017 06:42:25 PM (9 years ago)
Author:
aaroncampbell
Message:

Database: Hardening to bring wpdb::prepare() inline with documentation.

wpdb::prepare() supports %s, %d, and %F as placeholders in the query string. Any other non-escaped % will be escaped.

Merges [41496] to 3.9 branch.

Location:
branches/3.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.9

  • branches/3.9/tests/phpunit/tests/db.php

    r41480 r41506  
    709709                return 'fake_col_charset';
    710710        }
     711
     712        /**
     713         *
     714         */
     715        function test_prepare_with_unescaped_percents() {
     716                global $wpdb;
     717
     718                $sql = $wpdb->prepare( '%d %1$d %%% %', 1 );
     719                $this->assertEquals( '1 %1$d %% %', $sql );
     720        }
    711721}
    712722
Note: See TracChangeset for help on using the changeset viewer.