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

174 Commits

Author SHA1 Message Date
Gina Peter Banyard
964d087227 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/dba/tests/dba_db4_018.phpt: fix typo (#20938)
2026-01-24 11:39:06 +00:00
Michael Orlitzky
3053a039ff ext/dba/tests/dba_db4_018.phpt: fix typo (#20938)
We expect "objects" but print "object".

Gentoo-bug: https://bugs.gentoo.org/968656
2026-01-24 11:38:45 +00:00
David Carlier
5c6f25bd64 Merge branch 'PHP-8.4' 2025-09-21 14:26:02 +01:00
David Carlier
ea822513b3 Merge branch 'PHP-8.3' into PHP-8.4 2025-09-21 14:25:52 +01:00
David Carlier
933e087843 Fix GH-19885: dba_fetch() overflow on skip argument.
close GH-19887
2025-09-21 14:23:53 +01:00
Niels Dossche
366a5a2b37 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19706: dba stream resource mismanagement
2025-09-06 00:08:55 +02:00
Niels Dossche
f744c827a8 Fix GH-19706: dba stream resource mismanagement
This regressed in 8.4 when dba started mixing objects and resources
(streams).
The streams are first destroyed at a first step in shutdown, and in slow
shutdown then the symbol table is destroyed which destroys the dba
objects. The dba objects still use the streams but they have been
destroyed already, causing a UAF. Using dtor_obj instead of free_obj
would work around this but would cause issues like memory leaks because
dtor_obj may be skipped while free_obj may not be.
Instead, use the same solution as mysqlnd uses in that we fully manage
the stream lifecycle ourselves. This also avoids users from meddling
with the stream through get_resources().
This would be fixed 'automatically' in the future when we are using
objects for everything.

Closes GH-19710.
2025-09-06 00:08:15 +02:00
Gina Peter Banyard
8316ff2b0a ext/dba: Remove bool type coercions in tests 2025-06-21 22:19:11 +02:00
David Carlier
fed948dbd4 Fixed GH-18247: dba_popen() memory leak on invalid path.
and a handful more error code paths.

close GH-18250
2025-04-05 18:29:24 +01:00
Christian Schneider
4ca6bde32f Fix bug and add test for dba_open same file twice (#17979)
Co-authored-by: Christian Schneider <schneider@search.ch>
2025-03-11 11:08:53 +00:00
Niels Dossche
f473e86978 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/dba/tests/gh16390.phpt: skip if inifile is disabled
2024-12-06 19:02:17 +01:00
Michael Orlitzky
def271aaa7 ext/dba/tests/gh16390.phpt: skip if inifile is disabled
This test reads an ini "file" from a string, and expects a warning
about locking. But if inifile support is disabled, then you'll get

  Warning: dba_open(): Handler "inifile" is not available in
  /path/to/ext/dba/tests/gh16390.php on line 3

instead. We skip the test if inifile support is disabled.

Closes GH-17011.
2024-12-06 19:01:50 +01:00
Máté Kocsis
50264b03a0 Fix GH-16990 "dba_list() is now zero-indexed instead of using resource ids"
closes GH-17005
2024-12-03 00:48:34 +01:00
Niels Dossche
21df4a97a3 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport GH-14962 to stable versions
2024-11-26 21:25:05 +01:00
Michael Orlitzky
ae84b81bfa Backport GH-14962 to stable versions
Alpine CI regularly fails because of the sorting order of these tests.
See https://github.com/php/php-src/pull/14962#issuecomment-2498799881

Closes GH-16950.
2024-11-26 21:24:48 +01:00
Christoph M. Becker
2c0fd883b2 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16390: dba_open() can segfault for "pathless" streams
2024-10-21 00:38:18 +02:00
Christoph M. Becker
e635857f7d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16390: dba_open() can segfault for "pathless" streams
2024-10-21 00:33:29 +02:00
Christoph M. Becker
d3b0efe9d7 Fix GH-16390: dba_open() can segfault for "pathless" streams
`dba_open()` accepts arbitrary stream wrapper paths, but unless no
locking (`-`) is specified, we try to determine the underlying file
path.  If that fails, we need to error out.

Closes GH-16498.
2024-10-21 00:21:34 +02:00
Christoph M. Becker
8a2015451a Fix dba tests wrt resource to object conversion (GH-15716)
We should not pretend that there are still user-visible resources,
since we're dealing with objects now.
2024-09-03 14:23:57 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Banyard
bb2836eced ext/dba: Deprecate passing null|false to dba_key_split() (#15297)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_null_and_false_to_dba_key_split
2024-08-08 18:59:30 +01:00
Michael Orlitzky
44b0baf705 ext/dba/tests: sort expected test output (#14962)
* ext/dba/tests/setup/setup_dba_tests.inc: sort test output

Iterating through a database with firstkey() and nextkey() is
guaranteed to retrieve all rows, but apparently not in any particular
order. This is causing a test failure for at least one user, so we
steal the sort() approach from GDBM to ensure that the output is
predictable.

* ext/dba/tests/dba_*.phpt: sort expected test output

The actual output is now sorted for consistency, so we need to update
the expected output as well. As a nice side effect, some differences
in the expected outputs for the various engines have been eliminated.

Closes GH-14786

* ext/pgsql/tests/80_bug14383.phpt: sort expected test output

This test uses a routine from ext/dba that now sorts its (actual)
output, so we have to sort the expected output here as well.

* ext/dba/tests/setup/setup_dba_tests.inc: update comment

After doing some more digging, it looks like GDBM isn't the only
engine where the iteration order with firstkey() and nextkey()
might change unexpectedly.
2024-07-26 01:16:52 +01:00
Peter Kokot
2b2f755a11 Merge branch 'PHP-8.3'
* PHP-8.3:
  Use pattern tags for NDBM ext/dba/tests (#14755)
2024-07-01 22:06:41 +02:00
Peter Kokot
df37671bb9 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use pattern tags for NDBM ext/dba/tests (#14755)
2024-07-01 22:06:24 +02:00
Peter Kokot
98cb0be17d Use pattern tags for NDBM ext/dba/tests (#14755) 2024-07-01 22:06:10 +02:00
Ilija Tovilo
547cbf079f Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Add missing conflicts for dba test
2024-05-24 14:48:51 +02:00
Ilija Tovilo
dbbf5fff54 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Add missing conflicts for dba test
2024-05-24 14:48:42 +02:00
Ilija Tovilo
184ffe233a [skip ci] Add missing conflicts for dba test 2024-05-24 14:48:35 +02:00
Máté Kocsis
2097237da5 Migrate ext/dba resources to objects (#14239)
Related to https://wiki.php.net/rfc/resource_to_object_conversion and https://github.com/php/php-tasks/issues/6
2024-05-17 08:43:33 +02:00
Michael Orlitzky
4140394642 ext/dba/tests/dba_tcadb.phpt: support pthreadless tokyocabinet (#11648)
Several of our DBA tests (based on setup/setup_dba_tests.inc) have a
"no lock" version whose expected output is:

  SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock)

This tokyocabinet test, however, is missing the "modulo" bit, because
it is not output when tokyocabinet is built with pthreads support, as
is the case on at least Fedora and the GitHub CI.

To additionally support systems where tokyocabinet is built WITHOUT
pthreads support, this commit adds a wildcard at the end of the
expected output to catch the " (modulo..." string.
2023-08-02 16:50:02 +01:00
Máté Kocsis
134441efa9 Deprecate calling dba_fetch() with $dba at the 3rd parameter 2023-07-18 12:59:21 +02:00
Christoph M. Becker
f11228cdbe Add conflict markers for dba tests
These tests use the same filename, and as such must not be run in
parallel.
2022-08-04 16:23:26 +02:00
George Peter Banyard
eddab74021 Improve DBA test suite (#8904)
Generalises tests for all the different drivers.
Run the general test for the various drivers.

This allows support for parallel testing as the tests now do not rely on the same DB file.
2022-07-28 19:36:04 +01:00
Christoph M. Becker
89216b23dd Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-9155: dba_open("non-existing", "c-", "flatfile") segfaults
2022-07-27 12:16:25 +02:00
Christoph M. Becker
cf1664e91d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-9155: dba_open("non-existing", "c-", "flatfile") segfaults
2022-07-27 12:13:32 +02:00
Christoph M. Becker
a442e29485 Fix GH-9155: dba_open("non-existing", "c-", "flatfile") segfaults
We must not assume that the lock file has been opened.

Closes GH-9156.
2022-07-27 12:08:36 +02:00
George Peter Banyard
04f6fe4b25 Ammend DBA error message to use standard messaging 2022-07-26 00:25:39 +01:00
George Peter Banyard
3c372901bd Add support to pass driver flags to DBA handlers
Currently only LMDB with DBA_LMDB_USE_SUB_DIR/DBA_LMDB_NO_SUB_DIR are supported
2022-07-23 18:38:27 +01:00
George Peter Banyard
0887a1d7ab Remove personalisation from write on readonly db DBA error message 2022-07-23 18:38:27 +01:00
George Peter Banyard
7db32add9b Refactor dba_(p)open() to be more sensible (#7610)
Actually use ZPP
Throw ValueErrors for invalid values
Use dedicated struc members for file permission and map size instead of a zval stack
2021-11-06 23:09:40 +00:00
George Peter Banyard
a6cc76eeb8 Remove XFAIL
This was fixed in PHP 7 according to https://bugs.php.net/bug.php?id=61390 (which the linked commit points to)
2021-11-06 20:50:07 +00:00
George Peter Banyard
8ca7220bc9 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix Bug #81588 TokyoCabinet driver leaks memory
2021-11-03 15:02:12 +00:00
George Peter Banyard
5a3774cac5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix Bug #81588 TokyoCabinet driver leaks memory
2021-11-03 15:01:56 +00:00
George Peter Banyard
84524afb9e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix Bug #81588 TokyoCabinet driver leaks memory
2021-11-03 15:01:41 +00:00
George Peter Banyard
9f77373b4e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix Bug #81588 TokyoCabinet driver leaks memory
2021-11-03 14:58:11 +00:00
George Peter Banyard
96dd310c54 Fix Bug #81588 TokyoCabinet driver leaks memory 2021-11-03 14:57:47 +00:00
George Peter Banyard
8db5e70866 DBA should not convert elements in-place if the key param is an array
Also check that the value can actually be converted to string
2021-10-24 22:41:22 +01:00
George Peter Banyard
b50dc1e3a6 Fix DBA on MacOS (#7611)
The name zend_string* must be copied instead of returned directly in case the group part of the array is empty.
2021-10-23 20:53:11 +01:00
George Peter Banyard
e56c506020 Refactor DBA
Use proper ZPP union types
Use standard function signature semantics for dba_fetch()
Re-ordering of checks
2021-10-23 12:04:23 +01:00
Nikita Popov
218fd03532 Fix some more CLEANUP sections 2021-09-03 14:10:40 +02:00