Commit 3341925
authored
Parameterize PDO::lastInsertId() sequence-name lookup and fix non-ASCII sequence names (#1673)
* Fix sequence name binding in PDO::lastInsertId
Previous code didn't correctly handle non-ASCII bytes
* test(pdo): cover non-ASCII sequence names and injection-payload regression for lastInsertId
Add coverage to pdo_278_lastinsertid_seq.phpt for the parameterized
sequence-name lookup: a sequence whose name contains non-ASCII (Unicode)
characters now resolves correctly via lastInsertId(), and an injection-style
name is treated as a literal value that matches no sequence (returns an empty
string) rather than altering the query.
* test(pdo): set UTF-8 connection encoding for Unicode sequence-name case
The Unicode sequence-name literal is UTF-8. Explicitly set
PDO::SQLSRV_ATTR_ENCODING to UTF-8 before the Unicode DDL/DML and the
lastInsertId() lookup so the case reliably exercises the fix regardless of
the platform's system code page, addressing PR review feedback.1 parent 5fe2823 commit 3341925
2 files changed
Lines changed: 38 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
1630 | 1629 | | |
1631 | 1630 | | |
1632 | 1631 | | |
| 1632 | + | |
| 1633 | + | |
1633 | 1634 | | |
1634 | 1635 | | |
1635 | 1636 | | |
| |||
1638 | 1639 | | |
1639 | 1640 | | |
1640 | 1641 | | |
1641 | | - | |
1642 | | - | |
1643 | | - | |
1644 | | - | |
1645 | | - | |
1646 | | - | |
1647 | | - | |
| 1642 | + | |
1648 | 1643 | | |
1649 | 1644 | | |
1650 | 1645 | | |
| |||
1658 | 1653 | | |
1659 | 1654 | | |
1660 | 1655 | | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
1661 | 1667 | | |
1662 | 1668 | | |
1663 | 1669 | | |
| |||
1669 | 1675 | | |
1670 | 1676 | | |
1671 | 1677 | | |
| 1678 | + | |
1672 | 1679 | | |
1673 | 1680 | | |
1674 | 1681 | | |
| |||
1682 | 1689 | | |
1683 | 1690 | | |
1684 | 1691 | | |
| 1692 | + | |
1685 | 1693 | | |
1686 | 1694 | | |
1687 | 1695 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
59 | 78 | | |
60 | 79 | | |
61 | 80 | | |
62 | 81 | | |
63 | 82 | | |
64 | 83 | | |
65 | 84 | | |
| 85 | + | |
66 | 86 | | |
67 | 87 | | |
68 | 88 | | |
| |||
0 commit comments