Skip to content

Commit

Permalink
ext/pdo: Refactor PDO::FETCH_CLASS to not rely on a FCI and use a Has…
Browse files Browse the repository at this point in the history
…hTable for ctor_arg

To call the constructor we now only store the CE and a HashTable for the arguments.
This reduces the size of the _pdo_stmt_t struct from 320 bytes to 232 bytes.
Moreover, this now means that the constructor argument array follows the usual CUFA semantics.
This change is a BC break, as string keys now act like named arguments.
Moreover, the automatic wrapping of by-value arguments for by-ref parameters has been dropped, and the usual E_WARNING is now emitted in those cases.

The do_fetch() is heavily refactored to simplify the execution flow, which also makes it easier to understand.
Additionally we add a new bitflag in_fetch to prevent modification of the fetch flags by userland when PDO is fetching from the DB.
  • Loading branch information
Girgias committed Jan 30, 2025
1 parent 229df24 commit 3ff7758
Show file tree
Hide file tree
Showing 16 changed files with 342 additions and 426 deletions.
12 changes: 12 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ PHP 8.5 UPGRADE NOTES
. pcntl_exec() now throws ValueErrors when entries or keys of the
$env_vars parameter contain null bytes.

- PDO:
. The constructor arguments set in conjunction with PDO::FETCH_CLASS now
follow the usual CUFA (call_user_func_array) semantics.
This means string keys will act like a named argument.
Moreover, automatic wrapping for by-value arguments passed to a by-ref
parameter has been removed, and the usual E_WARNING about this is now
emitted.
To pass a variable by-ref to a constructor argument use the general
array value reference assignment: $ctor_args = [&$valByRef]
. Attempting to modify a PDOStatement during a call to PDO::fetch(),
PDO::fetchObject(), PDO::fetchAll() will now throw an Error.

- PDO_FIREBIRD:
. A ValueError is now thrown when trying to set a cursor name that is too
long on a PDOStatement resulting from the Firebird driver.
Expand Down
Loading

0 comments on commit 3ff7758

Please # to comment.