Commit graph

271 commits

Author SHA1 Message Date
David Carlier
ac9392b855
Merge branch 'PHP-8.4' 2025-04-05 18:33:12 +01: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
Gina Peter Banyard
1fa11f17ff
ext/dba: Add const modifier for argument to php_dba_make_key() 2025-03-25 04:01:40 +00:00
Gina Peter Banyard
345d229385
ext/dba: Reduce scope of dba_handler variables 2025-03-23 20:39:34 +00:00
Gina Peter Banyard
38fce780d9
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Update NEWS
  Fix bug and add test for dba_open same file twice (#17979)
2025-03-11 11:11:25 +00: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
Máté Kocsis
01093b7c13
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16990 "dba_list() is now zero-indexed instead of using resource ids"
2024-12-03 00:48:59 +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
Christoph M. Becker
65f885738d
Drop useless retrieval of opened_path (GH-16522)
There is no point in retrieving the real path, if we don't use it.
2024-10-21 14:42:43 +02:00
Christoph M. Becker
514c2b3587
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16390: dba_open() can segfault for "pathless" streams
2024-10-21 00:38:54 +02: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
DanielEScherzer
41996e8d4f
ext/[cd]*: fix a bunch of typos (#16298)
Only functional change is the renaming of the functions
`dom_document_substitue_entities_(read|write)` to replace `substitue` with
`substitute`.
2024-10-09 17:40:42 +02:00
Gina Peter Banyard
b445641dd7 ext/dba: php_dba_make_key() only returns NULL when an exception occurs 2024-10-05 17:48:28 +01:00
Gina Peter Banyard
41217bb06c ext/dba: Use zend_string for resource key instead of char*
At multiple time we would be creating a zend_string anyway
2024-10-05 17:48:28 +01:00
Niels Dossche
98dc77f660
Fix GH-15690: ext-dba failures on 32-bit (#15691)
The wrong type was used in the size calculation. On 64-bit this
coincidentally doesn't cause issues, but on 32-bit it does because of
different padding vs 64-bit resulting in a different size.

Regressed in 2097237.
2024-09-02 21:46:05 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
ad8480304d ext/dba: Remove duplicate check for empty mode 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
Gina Peter Banyard
8093893496
ext/dba: Remove arg num check prior to ZPP checks (#15401) 2024-08-14 20:20:11 +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
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Gina Peter Banyard
25a5146180
Clean-up unused headers (#14365)
* ext/mbstring.c: clean-up headers and include intrinsics
2024-06-01 17:12:42 +01: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
Máté Kocsis
134441efa9 Deprecate calling dba_fetch() with $dba at the 3rd parameter 2023-07-18 12:59:21 +02:00
George Peter Banyard
421c56dda2
Use zend_string for DBA path (#10698) 2023-04-08 17:03:28 +01:00
Max Kellermann
1287747a9a
ext: make various internal functions static (#10650)
Namely in:
* ext/date
* ext/libxml
* ext/dba
* ext/curl
2023-02-21 15:51:41 +00:00
Max Kellermann
263b22f374
Make lots of string pointers const (#10646)
This allows using string literals without implicitly casting away the
`const`.
2023-02-21 14:01:37 +00:00
Max Kellermann
d3facbe283
Mark globals as const (#10303)
This moves them from ``.data`` to ``.rodata`` and allows more compiler optimizations.

* ext/opcache/zend_accelerator_hash: make prime_numbers const

* Zend/zend_signal: make zend_sigs const

* ext/dba: make dba_handler pointers const

* ext/exif: make php_tiff_bytes_per_format and other globals const

* ext/intl/grapheme: make grapheme_extract_iters const

* ext/mstring: make rare_codepoint_bitvec const

* ext/snmp: make objid_mib const

* ext/opcache: make all zend_shared_memory_handlers const
2023-01-23 13:46:58 +00: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
Yurun
5cf2659fa5
Replace the use of ZVAL_BOOL() with ZVAL_TRUE() or ZVAL_FALSE() where the value is fixed (#8815) 2022-06-20 13:34:44 +01:00
George Peter Banyard
738adce79f Fix [-Wundef] warnings in DBA extension 2022-04-01 14:38:44 +01:00
George Peter Banyard
d71d0cf0bb Use zend_string for DBA first/next key handlers 2021-11-11 11:12:41 +00:00
George Peter Banyard
96ff88ec38 Use zend_string for DBA delete handler 2021-11-11 11:12:41 +00:00
George Peter Banyard
cd98e46583 Use zend_string for DBA exist handler 2021-11-11 11:12:41 +00:00
George Peter Banyard
0eb0f64455 Use zend_string for DBA update handler 2021-11-11 11:12:41 +00:00
George Peter Banyard
f8e15f1ed6 Use zend_string for DBA fetch handler 2021-11-11 11:12:41 +00:00
George Peter Banyard
c42336b8b8 Drop dba_lock.name element
This is unused
2021-11-11 11:12:41 +00: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
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
George Peter Banyard
e21d02a62a
Drop confusing ac local variable for ZEND_NUM_ARGS() 2021-10-23 10:30:34 +01:00
George Peter Banyard
c6862d0ed5
Inline DBA_GET2 macro
It was used only twice
2021-10-23 10:30:34 +01:00