Commit graph

701 commits

Author SHA1 Message Date
DanielEScherzer
ddd33fd7e4
Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
Gina Peter Banyard
8316ff2b0a ext/dba: Remove bool type coercions in tests 2025-06-21 22:19:11 +02:00
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
Niels Dossche
b63db81086
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/dba/tests/gh16390.phpt: skip if inifile is disabled
2024-12-06 19:02:22 +01: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
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
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
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
DanielEScherzer
53cb89670c
Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +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
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
Peter Kokot
558ccf7362
Autotools: Add 3rd argument to dba PHP_TEMP_LDFLAGS
[skip ci]
2024-08-31 00:41:41 +02:00
Peter Kokot
b3661701e1
Autotools: Sync CS in ext/dba (part 2) (#15621)
This is a follow-up of 4f6f4fb7d5

- PHP_DBA_DB_CHECK arguments quoted and normalized
- long lines reduced a bit
- Few additional AS_VAR_IF used
- Typo in variable name ${dbdp} fixed to ${dbdp4} as there is no dbdp
  variable anymore as of 4.x and 5.x paths checks
2024-08-30 00:59:44 +02:00
Peter Kokot
fbacc0f936
Autotools: Normalize PHP_ADD_BUILD_DIR 1st argument (#15612)
The m4_normalize(m4_expand([$1])) expands the given argument if it
contains M4 macros, and then trims the items together into a space
separated string in an intuitive way.
2024-08-29 00:44:29 +02:00
Peter Kokot
4f6f4fb7d5
Autotools: Sync CS in ext/dba (#15608)
- Macro headers synced with current PHP style (a minor description added
  and parameters)
- macro arguments quoted
- redundant double quotes reduces
- AS_VAR_IF macros used
- Redundant check message removed because there is already error thrown
  right after it
2024-08-28 14:52:24 +02:00
Máté Kocsis
8d12f666ae
Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +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
Peter Kokot
cff39cc400
[skip ci] Fix typo 2024-08-05 16:15:19 +02:00
Peter Kokot
77ad57c6c6
Add and update ext/dba preprocessor macros help texts (#15221) 2024-08-04 23:23:38 +02:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
2b97c84d4c
Autotools: Quote PHP_CHECK_LIBRARY arguments (#15136)
This syncs the quotes across the PHP_CHECK_LIBRARY macro arguments.
2024-07-28 18:39:14 +02:00
Peter Kokot
ff4b99e260
Autotools: Quote PHP_ADD_LIB* arguments (#15112)
Following previous CS syncs, this quotes arguments in PHP_ADD_LIB* M4
macros:
- PHP_ADD_LIBRARY
- PHP_ADD_LIBRARY_WITH_PATH
- PHP_ADD_LIBPATH
2024-07-26 23:26:55 +02: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
97afc86437
Autotools: Quote M4 arguments (#15045)
- AC_MSG_CHECKING
- AC_MSG_RESULT
- AC_MSG_WARN
- AC_MSG_ERROR
- AC_MSG_NOTICE
2024-07-21 01:52:17 +02:00
Peter Kokot
68ae477796
Autotools: Quote M4 arguments (#15033)
- PHP_ADD_INCLUDE
- PHP_EVAL_INCLINE
- PHP_EVAL_LIBLINE
2024-07-20 07:21:44 +02:00
Peter Kokot
0e2e8e0f13
Autotools: Quote all PHP_ADD_BUILD_DIR arguments (#14947)
- All arguments quoted for consistency
- m4_normalize used where list of directories becomes a bit simpler to
  read and see the diff
2024-07-14 16:58:43 +02:00
Peter Kokot
bee84c0468
Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02: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