Changeset 53577
- Timestamp:
- 06/25/2022 02:43:27 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/db.php
r53575 r53577 425 425 global $wpdb; 426 426 427 $placeholder_escape = $wpdb->placeholder_escape(); 428 427 429 return array( 428 430 array( … … 444 446 "SELECT * FROM $wpdb->users WHERE id = %d AND %% AND user_login = %s", 445 447 array( 1, 'admin', 'extra-arg' ), 446 "SELECT * FROM $wpdb->users WHERE id = 1 AND {$ wpdb->placeholder_escape()} AND user_login = 'admin'",448 "SELECT * FROM $wpdb->users WHERE id = 1 AND {$placeholder_escape} AND user_login = 'admin'", 447 449 ), 448 450 array( 449 451 "SELECT * FROM $wpdb->users WHERE id = %%%d AND %F AND %f AND user_login = %s", 450 452 array( 1, 2.3, '4.5', 'admin', 'extra-arg' ), 451 "SELECT * FROM $wpdb->users WHERE id = {$ wpdb->placeholder_escape()}1 AND 2.300000 AND 4.500000 AND user_login = 'admin'",453 "SELECT * FROM $wpdb->users WHERE id = {$placeholder_escape}1 AND 2.300000 AND 4.500000 AND user_login = 'admin'", 452 454 ), 453 455 array( … … 1551 1553 global $wpdb; 1552 1554 1555 $placeholder_escape = $wpdb->placeholder_escape(); 1556 1553 1557 return array( 1554 1558 array( … … 1562 1566 1, 1563 1567 true, 1564 "1 {$ wpdb->placeholder_escape()}{$wpdb->placeholder_escape()} {$wpdb->placeholder_escape()} {$wpdb->placeholder_escape()}1\$d{$wpdb->placeholder_escape()} {$wpdb->placeholder_escape()}1{$wpdb->placeholder_escape()}",1568 "1 {$placeholder_escape}{$placeholder_escape} {$placeholder_escape} {$placeholder_escape}1\$d{$placeholder_escape} {$placeholder_escape}1{$placeholder_escape}", 1565 1569 ), 1566 1570 array( … … 1604 1608 ' %s ', 1605 1609 false, 1606 "' {$ wpdb->placeholder_escape()}s '",1610 "' {$placeholder_escape}s '", 1607 1611 ), 1608 1612 array( … … 1610 1614 ' %s ', 1611 1615 false, 1612 " {$ wpdb->placeholder_escape()}s ",1616 " {$placeholder_escape}s ", 1613 1617 ), 1614 1618 array( … … 1616 1620 ' %1$s ', 1617 1621 false, 1618 " {$ wpdb->placeholder_escape()}1\$s ",1622 " {$placeholder_escape}1\$s ", 1619 1623 ), 1620 1624 array( … … 1622 1626 1, 1623 1627 true, 1624 "1 1 {$ wpdb->placeholder_escape()}{$wpdb->placeholder_escape()} {$wpdb->placeholder_escape()}",1628 "1 1 {$placeholder_escape}{$placeholder_escape} {$placeholder_escape}", 1625 1629 ), 1626 1630 array( … … 1664 1668 'hello', 1665 1669 false, 1666 "{$ wpdb->placeholder_escape()}s {$wpdb->placeholder_escape()}'hello'",1670 "{$placeholder_escape}s {$placeholder_escape}'hello'", 1667 1671 ), 1668 1672 array( … … 1670 1674 'hello', 1671 1675 false, 1672 "{$ wpdb->placeholder_escape()}s {$wpdb->placeholder_escape()}\"hello\"",1676 "{$placeholder_escape}s {$placeholder_escape}\"hello\"", 1673 1677 ), 1674 1678 array( … … 1676 1680 ' % s ', 1677 1681 false, 1678 "' {$ wpdb->placeholder_escape()} s '",1682 "' {$placeholder_escape} s '", 1679 1683 ), 1680 1684 array( … … 1682 1686 3, 1683 1687 false, 1684 "{$ wpdb->placeholder_escape()}f {$wpdb->placeholder_escape()}\"3.000000\"",1688 "{$placeholder_escape}f {$placeholder_escape}\"3.000000\"", 1685 1689 ), 1686 1690 array( … … 1700 1704 'hello', 1701 1705 true, 1702 "'{$ wpdb->placeholder_escape()}'{$wpdb->placeholder_escape()}s",1706 "'{$placeholder_escape}'{$placeholder_escape}s", 1703 1707 ), 1704 1708 array( … … 1706 1710 'hello', 1707 1711 false, 1708 "'{$ wpdb->placeholder_escape()}'{$wpdb->placeholder_escape()}s'hello'",1712 "'{$placeholder_escape}'{$placeholder_escape}s'hello'", 1709 1713 ), 1710 1714 array( … … 1712 1716 'hello', 1713 1717 false, 1714 "'{$ wpdb->placeholder_escape()}'{$wpdb->placeholder_escape()}s 'hello'",1718 "'{$placeholder_escape}'{$placeholder_escape}s 'hello'", 1715 1719 ), 1716 1720 array( … … 1760 1764 array( 'evil_%s_field', 321 ), 1761 1765 false, 1762 "WHERE `evil_{$ wpdb->placeholder_escape()}s_field` = 321;",1766 "WHERE `evil_{$placeholder_escape}s_field` = 321;", 1763 1767 ), 1764 1768 array( … … 1865 1869 public function data_escape_and_prepare() { 1866 1870 global $wpdb; 1871 1872 $placeholder_escape = $wpdb->placeholder_escape(); 1873 1867 1874 return array( 1868 1875 array( … … 1871 1878 'foo', // Data to send to prepare(). 1872 1879 true, // Whether to expect an incorrect usage error or not. 1873 " {$ wpdb->placeholder_escape()}s ", // Expected output.1880 " {$placeholder_escape}s ", // Expected output. 1874 1881 ), 1875 1882 array( … … 1885 1892 'foo', 1886 1893 false, 1887 " 'foo' {$ wpdb->placeholder_escape()}s ",1894 " 'foo' {$placeholder_escape}s ", 1888 1895 ), 1889 1896 );
Note: See TracChangeset
for help on using the changeset viewer.