Commit Graph

686 Commits

Author SHA1 Message Date
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
Peter Kokot
212b2834e9
Autotools: Sync indentation style in build system files (#14725) 2024-06-29 23:25:17 +02: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
Peter Kokot
cf3b9fca8f
Sync #if/ifdef/defined (-Wundef) (#14623)
These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of GH-5526
2024-06-24 19:37:07 +02:00
Peter Kokot
3da6377806
Remove DBA_DB1 definition from Windows build (#14649)
The DBA_DB1 is checked with #ifdef and version 1 emulation is present in
DB version 3.
2024-06-24 16:50:22 +02:00
Peter Kokot
c2f6fa4ee7
Use AC_DEFINE_UNQUOTED where variables are used (#14647)
According to Autoconf documentation AC_DEFINE_UNQUOTED should be used,
where shell variables are used in the macro arguments.
https://www.gnu.org/software/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fDEFINE_005fUNQUOTED-2

This also adds simple help descriptions to these CPP macros.
2024-06-23 23:53:50 +02:00
Peter Kokot
84a0da1574
Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
2024-06-09 14:23:41 +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
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
Máté Kocsis
0dfd2a93ab
Add ext/dba symbols in a namespace blok
In preparation of the opaque object to resource conversion
2024-05-08 23:44:31 +02:00
Máté Kocsis
10957e498c
Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Peter Kokot
b6bf7a0faf
Remove unused DBA_CDB_MAKE constant (#12535) 2023-10-27 17:37:24 +01: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