1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

384 Commits

Author SHA1 Message Date
Jordi Kroon
cb63e4f998 [skip ci] Remove obsolete comment (GH-20826) 2026-01-04 01:27:40 +01:00
Gina Peter Banyard
a3454b80e6 Fix GH-20553: PDO::FETCH_CLASSTYPE ignores $constructorArgs in PHP 8.5.0
We must assign the ctor_arguments regardless of modes.
This regression was introduced during the refactoring of PDO's internals

Closes GH-20595
2025-12-09 13:46:25 +00:00
Arnaud Le Blanc
6f32e1c690 Deprecate driver specific PDO constants
RFC: https://wiki.php.net/rfc/deprecations_php_8_5.

Closes GH-19526
2025-08-26 09:06:19 +02:00
Tim Düsterhus
4c5a6b0e8d tree-wide: Remove stacktraces from tests testing throwing clones (#18748)
This is in preparation for the possible future transformation of `clone` into a
function call, but also meaningful on its own, since the purpose of the tests
is not to test the stack trace generation, but rather that an exception was
thrown. It also cleans up some unreachable code in the tests.
2025-06-03 20:08:47 +02:00
Gina Peter Banyard
cd65240673 ext/pdo: Add tests for PDO::ATTR_STATEMENT_CLASS attribute (#17969) 2025-03-04 17:09:17 +00:00
Gina Peter Banyard
15d7b83ad3 ext/pdo: Improve test so that output is decipherable (#17394) 2025-02-11 13:30:35 +00:00
Gina Peter Banyard
4e55889dca ext/pdo: Refactor validation of fetch mode in PDO statement (#17699)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-02-09 00:35:33 +00:00
Gina Peter Banyard
790286ab6c ext/pdo: Pass argument number to pdo_dbh_attribute_set() 2025-02-04 19:28:47 +00:00
Gina Peter Banyard
9054a8f214 ext/pdo: Add test for lazy fetch mode 2025-02-04 11:23:08 +00:00
Gina Peter Banyard
3ff7758bcf ext/pdo: Refactor PDO::FETCH_CLASS to not rely on a FCI and use a HashTable 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.
2025-01-30 18:48:54 +00:00
Gina Peter Banyard
60ee42eb3e Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/pdo: Fix a UAF when changing default fetch class ctor args
2025-01-26 23:41:42 +00:00
Gina Peter Banyard
7f321a1313 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pdo: Fix a UAF when changing default fetch class ctor args
2025-01-26 23:37:14 +00:00
Gina Peter Banyard
3027600ffc ext/pdo: Fix a UAF when changing default fetch class ctor args
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-01-26 23:32:35 +00:00
Gina Peter Banyard
37cd00e170 ext/pdo: Add a test with a fetchAll() call being interupted partways 2025-01-26 13:31:16 +00:00
Gina Peter Banyard
8a81d005e5 ext/pdo: Add a test creating instances of Directory
This should not be possible, other opaque classes cannot be instantiated in practice as they do not have properties and prevent dynamic properties
2025-01-26 13:31:16 +00:00
Gina Peter Banyard
5b06a066f6 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:22:13 +00:00
Gina Peter Banyard
8ed0d7fe96 Merge branch 'PHP-8.4'
* PHP-8.4:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:20:11 +00:00
Gina Peter Banyard
eda8ce728a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
  Fix GHA config yml error
2025-01-24 20:20:01 +00:00
Gina Peter Banyard
99f8ec33d9 ext/pdo: Fix memory leak if GC needs to free PDO Statement 2025-01-24 20:16:12 +00:00
Gina Peter Banyard
6bd2b8dfa5 ext/pdo: Throw an exception instead of fatal error if the class is not found (#17528) 2025-01-19 23:35:24 +00:00
Gina Peter Banyard
9283abc1a0 ext/pdo: Rename and add tests for PDO::FETCH_CLASS fetch mode (#17526) 2025-01-19 20:33:13 +00:00
Gina Peter Banyard
df8ac4af91 ext/pdo_odbc: Do not populate message if there is no driver error (#17478) 2025-01-15 20:46:08 +00:00
Gina Peter Banyard
abfa377fae ext/pdo: Add FETCH_INTO setting via setAttribute "hack" 2025-01-15 03:02:30 +00:00
Gina Peter Banyard
11937b3df7 ext/pdo: Add a test for PDO::FETCH_FUNC with a return by-ref callback (#17425) 2025-01-10 17:27:19 +00:00
Gina Peter Banyard
576f5fac23 ext/pdo: Move PDO MySQL test to common 2025-01-09 10:30:10 +00:00
Gina Peter Banyard
19dd79bdee ext/pdo: Refactor PDOStatement::fetchAll()
This also refactors the internal do_fetch() function to stop doing wonky stuff to handle grouping, which is a feature of fetchAll

Handle PDO_FETCH_KEY_PAIR on its own as GROUP and UNIQUE flags can interfere with it
2025-01-07 09:10:05 +00:00
Gina Peter Banyard
4dd9acccd2 ext/pdo: Move common PDO bug test and enhance it 2025-01-07 09:10:05 +00:00
Gina Peter Banyard
60252b7845 ext/pdo: Improve testing for FETCH_FUNC mode (#17325) 2025-01-02 23:31:25 +00:00
Saki Takamachi
a800a03562 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Added gc_handler to properly handle circular references. (#16703)
2024-11-06 20:32:33 +09:00
Saki Takamachi
ca27e40a5f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Added gc_handler to properly handle circular references. (#16703)
2024-11-06 20:31:30 +09:00
Saki Takamachi
4d14325b19 Added gc_handler to properly handle circular references. (#16703)
closes #16703

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-11-06 20:30:08 +09:00
Máté Kocsis
a5f137821a Fix GH-16314 "Pdo\Mysql object is uninitialized" when opening a persistent connection (#16369) 2024-11-05 08:32:44 +01:00
Gina Peter Banyard
5c7a0abe55 Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/pdo: Fix various PDORow bugs
2024-02-27 15:32:20 +00:00
Gina Peter Banyard
ddebe469e1 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/pdo: Fix various PDORow bugs
2024-02-27 15:31:48 +00:00
Gina Peter Banyard
b4e272c56a ext/pdo: Fix various PDORow bugs
- Add tests
- NULL derefencing in read_dimension handler
- Fix isset()
- Fix empty() with column numbers as offsets
- Refactoring to use common functions
2024-02-27 15:30:23 +00:00
Peter Kokot
085da2725f Merge branch 'PHP-8.3'
* PHP-8.3:
  Use EXTENSIONS instead of SKIPIF sections in *.phpt
2024-01-31 11:20:56 +01:00
Peter Kokot
8d5fc8d23f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use EXTENSIONS instead of SKIPIF sections in *.phpt
2024-01-31 11:20:44 +01:00
Peter Kokot
218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00
Máté Kocsis
d6a0b3af68 Implement PDO driver-specific subclasses
RFC: https://wiki.php.net/rfc/pdo_driver_specific_subclasses
Closes GH-12804

Co-Authored-By: Danack <Danack@basereality.com>
2024-01-11 23:22:41 +01:00
Saki Takamachi
4bb75d569e ext/pdo_mysql: Optimize tests (#12751) 2023-11-27 13:01:24 +00:00
Saki Takamachi
dfaf7986de [pdo_firebird] Transaction management optimization (#12741)
take2 of #12657

## About Firebird transaction

Firebird is a full transactional database, so the DB itself does not support autocommit mode. (Strictly, there is an autocommit mode, but it is a different concept from the "autocommit" that we are used to with MySQL and others.)

Therefore, a transaction must have started before any operation is performed, and autocommit mode had to be emulated in PHP.

I made sure that a transaction always exists when in autocommit mode. Since the `in_transacntion` function does not work as expected, I have introduced `H->in_manually_txn` to determine whether a transaction is being manually manipulated.

## There are two types of commit/rollback

(I'm not talking about two-phase commit. This change does not take into account two-phase commit.)

There are `isc_commit_retaining` which starts a transaction again in the same context immediately after committing, and `isc_commit_transaction` which closes the transaction as is.

Similarly, there are two types of rollback.

-----------

Due to the default value of the transaction isolation level, autocommit mode may obtain unintended results.
Regarding this, it would be too large to include support for transaction isolation levels in this PR, so I will leave it as is for now.
2023-11-27 03:38:48 +00:00
George Peter Banyard
c1fec9bbc3 PDO: Clean-up tests so it's easier to see if they use default test table (#12552) 2023-10-29 23:13:30 +00:00
Máté Kocsis
f4a5db3e08 Parallelize pdo tests (dblib, firebird, oci, odbc, pgsql) (#12395)
Co-authored-by: George Peter Banyard <girgias@php.net>
Co-authored-by: Jorg Adam Sowa <jorg.sowa@gmail.com>
2023-10-28 12:35:57 +01:00
Máté Kocsis
8726ae0601 Improve and fix ext/odbc tests
Some test failures are fixed, parallelization is enabled, section order is fixed.
2023-08-23 21:20:41 +02:00
Máté Kocsis
10a27bc47b Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix pdo_oci tests for PHP 8.1
2022-08-24 14:40:01 +02:00
Michael Voříšek
2db2cab6ad Fix pdo_oci tests for PHP 8.1
Closes GH-9051
2022-08-24 14:39:45 +02:00
Máté Kocsis
ae95644f36 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix pdo_oci tests for PHP 8.0
2022-08-22 09:29:32 +02:00
Máté Kocsis
3e0f144b2c Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix pdo_oci tests for PHP 8.0
2022-08-22 09:28:29 +02:00
Michael Voříšek
305892580e Fix pdo_oci tests for PHP 8.0 2022-08-22 09:25:43 +02:00
Tim Düsterhus
6906d1fc8d Mark parameter in ext/pdo as sensitive 2022-06-13 11:09:12 +02:00