8 Commits
Author SHA1 Message Date
dev-null-undefined b91ea8889c Fix GH-24490: pdo_pgsql prepare() hangs on a query containing a NUL byte
No rule in the scanner matches a NUL byte, so what re2c does with one
is undefined. Before 5ccc56b1e4 it happened to skip one character. Now
it returns a zero-length text token and pdo_parse_params() loops
forever, or reads an uninitialized YYMARKER if the NUL is the first
byte. Add a default rule so a NUL is skipped as one character of text
again.

Close GH-24496
2026-10-22 14:26:24 +01:00
Matthias DötschandGina Peter Banyard 5ccc56b1e4 ext/pdo_pgsql: Speed up the SQL scanner
The scanner that finds placeholders in queries excluded e/E from plain
text, because they can start an E'...' string. So every e/E in a query
(SELECT, WHERE, created_at, ...) ended a text token and became a
one-character token of its own. Allow e/E inside text as long as the
text doesn't end with one, so E'...' strings are still recognized.

Also let re2c generate bitmaps (-b) for the character classes instead
of a switch on every input character.

The scanner runs in PDO::prepare() and, with emulated prepares, again in
PDOStatement::execute(). Instructions for 200k calls of prepare():

                    emulated   native
  SELECT, 11 cols     -24%      -16%
  INSERT, 8 params    -15%       -7%

For a whole emulated query (prepare, execute, fetch one row) against a
local server, PHP executes 7-9% fewer instructions.

Co-authored-by: Gina Peter Banyard <girgias@php.net>

Close GH-24353
2026-10-17 11:30:14 +01:00
Ben Ramsey eca7fb4115 license-update: ext/pdo_pgsql source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Christoph M. Becker a57ce052cd Don't export php_pdo_int.h
This is, as the name and a comment in the header imply, an internal
header which is not supposed to be used by extensions other than PDO
(not even by drivers).

Since there is apparently no need to include this header in the parsers
of the drivers, we remove these includes, and no longer declare the
header to be installed.  Given that the header is only exported for a
couple of weeks[1], this is not considered to be a BC break, because
it's unlikely that external drivers have already been adjusted to use
this header, and otherwise they can still be fixed; PHP 8.4 is still in
the pre-release stage.

[1] <https://github.com/php/php-src/pull/14797>

Closes GH-15688.
2024-09-01 13:33:53 +02:00
Peter Kokot 2ebef11e83 Update http links to https and sync www.php.net URLs (#14854) 2024-07-07 04:23:08 +02:00
Matteo Beccati 01879ec254 pdo_pgsql: add support for dollar-quotes
RFC: http://wiki.php.net/rfc/pdo_driver_specific_parsers
2024-06-17 23:31:24 +02:00
Matteo Beccati e82c486918 pdo_pgsql: add support for "escape" string literals
RFC: http://wiki.php.net/rfc/pdo_driver_specific_parsers
2024-06-17 23:31:24 +02:00
Matteo Beccati 715b9aaa09 Implemented PDO Driver specific SQL parsers
RFC: http://wiki.php.net/rfc/pdo_driver_specific_parsers
2024-06-17 23:31:24 +02:00