1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00

213 Commits

Author SHA1 Message Date
Ilija Tovilo
07e29acbd4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:21 +01:00
Ilija Tovilo
6f91209260 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:14 +01:00
Ilija Tovilo
c6ad84fb9e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:04:24 +01:00
Ilija Tovilo
3a57b4ced5 Add RUN_RESOURCE_HEAVY_TESTS env var
Disable resource-heavy tests by default (>1GB of memory usage), unless the
RUN_RESOURCE_HEAVY_TESTS env variable is set.

Fixes GH-20762
Closes GH-20935
2026-02-27 15:00:35 +01:00
Tim Düsterhus
1cb166cbbb pdo: Fix scope for PDO mixins in pdo_hash_methods() (#20200)
From what I see the incorrect scope is not observable in any other way. The
mixin methods are completely invisible to Reflection and a SQLite function
referring to a private method is still properly called as before.

Fixes php/php-src#20095.
2025-10-19 14:13:54 +02:00
Samuel Štancl
a09d919ce8 Implement GH-8967: Add PDO_SQLITE_ATTR_TRANSACTION_MODE (#19317)
This commit implements GH-8967.

SQLite supports multiple transaction modes. These include:
- DEFERRED (default) only acquires a lock when you start a read/write
- IMMEDIATE acquires a reserved lock
- EXCLUSIVE acquires an exclusive lock (stricter than immediate)

In WAL mode IMMEDIATE and EXCLUSIVE are identical.

One reason for wanting to specify a transaction mode is that SQLite
doesn't respect busy_timeout when a DEFERRED transaction tries to
upgrade a read lock to a write lock. Normally if you try to acquire a
lock and have busy_timeout configured, SQLite will wait for that period
until giving up and erroring out (SQLITE_BUSY). With DEFERRED, if you
have a transaction that first reads and there's a concurrent writer
while it's trying to upgrade to a write lock, you will immediately get
SQLITE_BUSY regardless of your busy_timeout.

Prior to this commit, the only available workarounds were:
- Using $pdo->exec("BEGIN IMMEDIATE TRANSACTION") instead of
  $pdo->beginTransaction()
- Doing a dummy write at the start of each transaction so you don't get
  stuck with a read lock

Both of those aren't very usable, especially in a framework context
where the user doesn't have complete control over how transactions are
started.

To address that, this commit adds four class constants to Pdo\Sqlite:
- ATTR_TRANSACTION_MODE -- a new attribute
- TRANSACTION_MODE_DEFERRED = 0
- TRANSACTION_MODE_IMMEDIATE = 1
- TRANSACTION_MODE_EXCLUSIVE = 2

These can be used as:
  $pdo->setAttribute(
    $pdo::ATTR_TRANSACTION_MODE,
    $pdo::TRANSACTION_MODE_IMMEDIATE
  );
2025-09-07 15:42:30 +02:00
Arnaud Le Blanc
a4afc57f1d Deprecate driver specific PDO methods
RFC: https://wiki.php.net/rfc/deprecations_php_8_5.

Closes GH-19596
2025-09-03 08:42:33 +02: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
732069d98b pdo: Deprecate the uri: DSN scheme (#19274)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_pdo_s_urischeme
2025-08-08 21:24:15 +01:00
David CARLIER
f129586459 ext/pdo_sqlite: fix minimal version for EXPLAIN feature support. (#18854) 2025-06-18 21:06:03 +01:00
David CARLIER
7361a1206d ext/pdo_sqlite: explain statement prefixing with its class for errors. (#18846) 2025-06-13 19:19:13 +01:00
David Carlier
71a254489c ext/pdo_sqlite: EXPLAIN mode support for SQL statements.
available since 3.41.0 we can reprepare a statement in either
 explain, explain query plan or the usual prepared mode.

close GH-18829
2025-06-13 05:45:45 +01:00
David Carlier
53231a81dd ext/pdo_sqlite: adding Pdo_Sqlite::ATTR_BUSY_STATEMENT
allow to check if a statement is still running before reusage.

close GH-18804
2025-06-09 18:24:35 +01:00
David Carlier
e3cfa4bcae ext/pdo_sqlite: PDO::sqliteCreateCollection return type strenghtening.
Is supposed to be Pdo_Sqlite::createCollation but behavior differs in
regard of return type checks.

close GH-18799
2025-06-08 13:29:26 +01:00
David CARLIER
ceffa70b97 ext/pdo_sqlite: Fix GH-18796 test exception message. (#18798) 2025-06-07 15:53:46 +01:00
David Carlier
b72dccb3e3 Merge branch 'PHP-8.4' 2025-06-07 14:29:13 +01:00
David Carlier
1044558b64 ext/pdo_sqlite: createCollation memory leaks fix.
coming from callback arguments when its return type is incorrect.

close GH-18796
2025-06-07 14:28:29 +01:00
Niels Dossche
8376904aeb Implement GH-17321: Add setAuthorizer to Pdo\Sqlite (#17905) 2025-04-18 00:34:46 +02:00
hanshenrik
0a10f6db26 ext/pdo_sqlite - throw on null bytes / resolve GH-13952 (#18320)
fix a corruption issue where PDO::quote for SQLite would silently truncate
strings with null bytes in them, by throwing.

Fixes #13952
Closes #18320
2025-04-15 08:52:31 +09:00
Niels Dossche
c4a79617a9 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when destroying PDORow
2025-03-20 23:14:37 +01:00
Niels Dossche
0ef57501d9 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when destroying PDORow
2025-03-20 23:14:14 +01:00
Niels Dossche
2dde07af55 Fix memory leak when destroying PDORow
This should call zend_object_std_dtor() to clean the property table etc.
This also has a semantic influence because previously weak refs were not
notified for example.

This fixes the final issue in GH-18114 (the crash was master-only and
fixed already).

Closes GH-18114.
Closes GH-18123.
2025-03-20 23:13:42 +01:00
Niels Dossche
e1eeb483ef Fix GH-18114: pdo lazy object crash (#18116)
Since 0537968, the properties are no longer initialized.
So we call object_properties_init to handle that correctly.
Lower branches have a memory leak, but that requires a separate fix.
2025-03-19 23:43:30 +01:00
Christoph M. Becker
3d9a0a0c17 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17837: ::getColumnMeta() on unexecuted statement segfaults
2025-02-18 17:03:33 +01:00
Christoph M. Becker
4a514f653a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17837: ::getColumnMeta() on unexecuted statement segfaults
2025-02-18 17:03:00 +01:00
Christoph M. Becker
260e0e9bd3 Fix GH-17837: ::getColumnMeta() on unexecuted statement segfaults
We cannot properly get the column meta data of a statement which has
been prepared, but has not yet been executed.  As such we bail out
early, reporting failure.

Closes GH-17850.
2025-02-18 17:01:46 +01:00
Gina Peter Banyard
60252b7845 ext/pdo: Improve testing for FETCH_FUNC mode (#17325) 2025-01-02 23:31:25 +00:00
Máté Kocsis
5892991941 Fix GH-16131: Prevent mixing PDO sub-classes with different DSN 2024-10-22 22:51:29 +02:00
David Carlier
58a6e5551e Merge branch 'PHP-8.3' 2024-06-29 15:52:52 +01:00
David Carlier
1b71a9e01f Merge branch 'PHP-8.2' into PHP-8.3 2024-06-29 15:52:28 +01:00
David Carlier
c03196a5be Fix GH-14712: segfault on invalid object.
If the extension does not allow to get a property pointer (like PDORow
object), we fallback
to the read property cb anyway.
2024-06-29 15:51:57 +01:00
Matteo Beccati
3096ffa7ab pdo_sqlite: identifier quoting with square brakets 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
Máté Kocsis
6ec4220148 Amend PDO driver-specific class names (#14069)
As suggested in https://externals.io/message/123166
2024-05-30 20:15:42 +02:00
Niels Dossche
b7bf846f72 Fix bug #81227: PDO::inTransaction reports false when in transaction (#14268) 2024-05-20 13:59:26 +02:00
Saki Takamachi
cf92a191e8 ext/pdo_sqlite: Use new F ZPP (#14059)
closes #14059
2024-05-01 23:44:41 +09:00
Saki Takamachi
3e3875c379 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13998: Manage refcount of agg_context->val correctly (#14004)
2024-04-20 22:34:53 +09:00
Saki Takamachi
43064160c4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13998: Manage refcount of agg_context->val correctly (#14004)
2024-04-20 22:34:31 +09:00
Saki Takamachi
2a1aa8cac5 Fix GH-13998: Manage refcount of agg_context->val correctly (#14004)
When step_callback fails, agg_context->val is passed dtor, but agg_context->val
is also used in final_callback regardless of the success/failure of step_callback,
so should not call dtor.

closes #14004
fixes #13998
2024-04-20 22:33:25 +09:00
Saki Takamachi
d14b208552 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13984: Buffer size is now checked before memcmp (#13991)
2024-04-18 08:38:18 +09:00
Saki Takamachi
dd5cdfd645 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13984: Buffer size is now checked before memcmp (#13991)
2024-04-18 08:37:55 +09:00
Saki Takamachi
fda91a0543 Fix GH-13984: Buffer size is now checked before memcmp (#13991)
Fixed an issue where a buffer overflow occurred when a string shorter than
`:memory:` was passed as the db name of pdo_sqlite.

fixed #13984
closes #13991
2024-04-18 08:35:50 +09:00
Nikita Popov
67184f5445 Fix PdoSqlite::loadExtension() test (#13736)
The test contained a syntax error and an incorrect use of loadExtension(), which returns void not bool.

Also install the necessary package in CI, so it gets tested there.
2024-03-17 22:27:09 +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
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
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
Alexandre Daubois
417f3fdb91 Improve ext/pdo_sqlite tests cleanup (#11900) 2023-08-08 09:49:02 +01:00