Commit Graph

67623 Commits

Author SHA1 Message Date
Peter Kokot
a5f8cbd93d
Autotools: Refactor mysql_config checks in pdo_mysql (#15336)
- Scattered if blocks moved together as PDO_MYSQL_UNIX_ADDR is defined
  only when mysql_config is available
- Obsolete backticks command substitutions `...` replaced with the
  recommended $(...)
2024-08-11 12:18:27 +02:00
Niels Dossche
e1c8329b8c Update TODOs in com_dotnet 2024-08-10 23:24:26 +02:00
Niels Dossche
3f54be8053 Get rid of le_dispatch 2024-08-10 23:24:26 +02:00
Niels Dossche
b7be849fad Get rid of le_istream 2024-08-10 23:24:26 +02:00
David Carlier
1d198c660c
ext/sockets: controlling ephemeral port ranges on *BSD.
whether ephemeral ports are onto the privileged low port ranges
     or a range more fit for restricted scenarios.

close GH-15335
2024-08-10 22:16:51 +01:00
Peter Kokot
e5f6387569
Autotools: Refactor pdo_mysql checks (#15334)
- Main checks wrapped in AS_CASE
- s/UNIX/Unix
- Redundant MYSQL_SOCK variable removed
2024-08-10 21:52:38 +02:00
Gina Peter Banyard
edc88ee629
ext/standard: Minor refactoring to URL scanner code (#15321) 2024-08-10 20:12:54 +01:00
Niels Dossche
8d7365b6f0
Fix GH-15331: dom: Element::$substitutedNodeValue test failed
Bug in libxml, amend test to accept both outputs.
2024-08-10 19:43:21 +02:00
Christoph M. Becker
9b41c8b1b5
Declare gdImageGetInterpolationMethod() for bundled GD (GH-15329)
When this function has been added to our bundled GD[1], it had been
overlooked to also declare it in gd.h, like it's done in libgd.  While
MSVC doesn't have any issues with this, clang reports an error.

[1] <03bd4333f6>
2024-08-10 16:57:48 +02:00
Niels Dossche
db5ea45f0f
Fix incorrect type check in removeAttributeNode 2024-08-10 16:31:23 +02:00
Christoph M. Becker
9c537de8a5
Fix some -Wimplicit-function-declaration errors on Windows (GH-15325)
While clang is picky about these, MSVC doesn't seem to care and would
only report the calls to undeclared functions as errors during link
time.  Still, obviously, MSVC is fine with having the declarations
during compile time.
2024-08-10 16:25:28 +02:00
Arnaud Le Blanc
c02c1d4474
Change YIELD/YIELD_FROM to do not increment opline (#15328)
YIELD and YIELD_FROM increment opline before returning, but in most places
we need the opline to point to the YIELD and YIELD_FROM.

Here I change YIELD / YIELD_FROM to not increment opline. This simplifies the
code and fixes GH-15275 in a better way.

Closes GH-15328
2024-08-10 16:09:47 +02:00
Niels Dossche
0122be574a
Simplify document standalone setter (#15320)
The logic was very weird as it just should check whether the boolean is
true or not. And in fact the code is equivalent because zval_get_long()
will only return 0/1 because the type is a bool, and ZEND_NORMALIZE_BOOL
won't change that value.
2024-08-10 15:35:04 +02:00
Christoph M. Becker
ee02e4be6a
Fix violation of the one definition rule in ext/com_dotnet (GH-15327)
The definition of the class entries in the internal header file is not
correct, since that file is included several times, and even the
comment above the definition hints at com_extension.c where the actual
definition is.  We fix this by declaring these variables as `extern`.
2024-08-10 15:27:32 +02:00
David Carlier
d5c7f3b0e6
ext/standard: enabling feature detection auxiliary vector on OpenBSD.
close gh-15175
2024-08-10 12:36:10 +01:00
Peter Kokot
fcd4d391fa
Autotools: Refactor mysqli extension checks (#15323)
- AS_* macros used
- s/UNIX/Unix
- The --with-mysql result value moved into the check when extension is
  enabled
- List of source files normalized with m4_normalize
- Redundant variables omitted
- CS synced
2024-08-10 10:08:17 +02:00
Peter Kokot
dbdc79df95
Autotools: Fix SNMP checks (#15263)
This is a follow-up of GH-15242
(0b25e26b4e)

because the usmHMAC192SHA256AuthProtocol and usmHMAC384SHA512AuthProtocol
are not functions but arrays. The AC_CHECK_DECL might be more
appropriate and portable way to find these.
2024-08-10 09:15:28 +02:00
Kamil Tekiela
7801f40449
Deprecate mysqli_kill (#11926) 2024-08-09 19:50:35 +02:00
Gina Peter Banyard
42497c1ea5
ext/soap: Deprecate passing an int to SoapServer::addFunction() (#15310)
Also deprecate SOAP_FUNCTIONS_ALL constant.

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
2024-08-09 17:41:02 +01:00
Kamil Tekiela
cbcad9fdaf
Deprecate mysqli_ping (#11945) 2024-08-09 18:32:21 +02:00
Peter Kokot
3a30c29d73
Autotools: Add pkg-config support for NET-SNMP library (#15261)
NET-SNMP has pkg-config support since 5.8.1

This optionally finds the NET-SNMP library using pkg-config or falls
back to find library on the system with net-snmp-config. The configure
option argument (--with-snmp=DIR) works like before (path to the
net-snmp-config).

When explicitly using the DIR argument, the pkg-config check is silently
skipped.

When not using DIR argument, the SNMP_CFLAGS and SNMP_LIBS can be also
used to find the NET-SNMP library:

    ./configure --with-snmp \
        SNMP_CFLAGS=-I/path/to/net-snmp/include \
        SNMP_LIBS="-L/path/to/net-snmp -lnetsnmp"

Co-authored-by: Calvin Buckley <calvin@cmpct.info>
2024-08-09 18:08:32 +02:00
Peter Kokot
8044db121f
Update mysql preprocessor macros help texts (#15288)
This adds missing help texts for preprocessor macros defined in
mysqli and pdo_mysql extensions.

[skip ci]
2024-08-09 18:07:05 +02:00
Peter Kokot
72fb00b644
Update gd extension preprocessor macros help texts (#15296)
PHP_GD_CHECK_FORMAT macro 2nd argument is changed from automatic
AC_DEFINE_UNQUOTED to manual action for easier usage.
2024-08-09 18:06:02 +02:00
Gina Peter Banyard
1e3d918936
ext/core: Deprecate passing E_USER_ERROR to trigger_error() (#15308)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
2024-08-09 15:51:07 +01:00
Kamil Tekiela
42336e1359
Deprecate mysqli_refresh (#11929) 2024-08-09 15:47:49 +01:00
Peter Kokot
bd77462c7c
Update sqlite3 and pdo_sqlite preprocessor macros help texts (#15291) 2024-08-09 14:51:05 +02:00
Ilija Tovilo
46ee0fb304
Disallow indirect modification on readonly properties within __clone() (#15012)
Indirect modification isn't allowed in __construct() because it allows
references to leak, so it doesn't make much sense to allow it in __clone().
2024-08-09 11:56:16 +02:00
Ilija Tovilo
7a2d5efa0f
[JIT] Avoid generating fast property assign path for readonly properties (#15260)
readonly properties will usually be IS_UNDEF on assignment, dodging the fast
path anyway. The fast path does not handle the readonly scope check. The
alternative would be handling scope there, but since there are some many
variants that might be more trouble than it's worth.
2024-08-09 11:49:40 +02:00
Peter Kokot
42c9963133
Autotools: Quote PHP_CXX_COMPILE_STDCXX macro arguments
[skip ci]
2024-08-09 10:39:16 +02:00
Peter Kokot
e8f2e530b0
Autotools: Sync CS in hash extension (#15302)
- AS_* macros used
- list of source files added to argument directly and normalized with
  m4_normalize()
- hash_sha3.c source file simplified
2024-08-09 01:45:50 +02:00
Gina Peter Banyard
25b4696530
ext/xml: Deprecate xml_set_object() and passing non-callable strings as handlers (#15293) 2024-08-08 23:37:49 +01:00
Tim Düsterhus
6eca7839af
hash: Add SHA-NI implementation of SHA-256 (#15152)
* hash: Add SSE2 implementation of SHA-256

Implementation taken from
tarsnap/libcperciva@661752aee8.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>

* zend_cpuinfo: Add ZEND_CPU_FEATURE_SHA

* hash: Add SHA-NI implementation of SHA-256

Implementation taken from
tarsnap/libcperciva@661752aee8.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

* NEWS / UPGRADING

---------

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-08-08 22:19:33 +02:00
Gina Peter Banyard
c8b45aa59a
ext/spl: Follow-up on GH-9704 (#15295)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2024-08-08 19:31:51 +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
Niels Dossche
746b1cf43e
Access long value directly for call to count() in simplexml (#15278)
Because the signature is checked at compile time, we know that the only
possible return value (if there is no exception) is IS_LONG. So we can
avoid some work.
2024-08-08 19:28:03 +02:00
Tyson Andre
43def0af46
Deprecate SplFixedArray::__wakeup() (#9704)
GH-9354 added the `__serialize` and `__unserialize` method,
so unserialize() and other unserializers will call `__unserialize`
instead of `__wakeup` for SplFixedArray and userland subclasses.

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_splfixedarraywakeup
2024-08-08 16:16:42 +01:00
Peter Kokot
80ae7f7979
Update pgsql extensions preprocessor macros help texts (#15290)
[skip ci]
2024-08-08 16:14:43 +02:00
Peter Kokot
bf5de048e0
Update ext/tidy preprocessor macros help texts (#15269)
[skip ci]
2024-08-08 08:29:43 +02:00
Peter Kokot
f661223685
Update ext/sodium preprocessor macro help texts (#15270)
The sodium extension was initially named "libsodium" in PECL and was
renamed to sodium when it was bundled to php-src. The HAVE_LIBSODIUMLIB
symbol here could indicate that PHP extension sodium is available.

Otherwise the macro is not used in the current code base. Header
php_libsodium.h became "installed"/public as of PHP-8.4.

[skip ci]
2024-08-08 08:27:22 +02:00
David Carlier
f503cc0234
Merge branch 'PHP-8.3' 2024-08-07 22:38:48 +01:00
David Carlier
cad0ce5382
CI disable leak sanitizer on two libedit tests temporarily.
the libedit dependency has a leak on wcsdup call on ubuntu focal

close GH-15279
2024-08-07 22:38:30 +01:00
Peter Kokot
ca57d763ce
Update ext/zip preprocessor macros help texts (#15271)
[skip ci]
2024-08-07 17:03:59 +02:00
Niels Dossche
027b210d42
Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)"
2024-08-07 10:04:58 +02:00
Niels Dossche
1d56340831
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Revert "Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)"
2024-08-07 10:03:35 +02:00
Niels Dossche
28290655e8
Revert "Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)"
This reverts commit 476706165a.

Although the fix is correct, people are relying on the bug and their
code stopped working, see GH-15252.
2024-08-07 10:03:12 +02:00
Peter Kokot
a49e0a42a1
Autotools: Quote AC_PATH_PROG arguments in ext/pdo_firebird
[skip ci]
2024-08-07 09:19:40 +02:00
Peter Kokot
5fc68d8bab
Update preprocessor macros help texts for enchant and snmp extensions (#15255)
[skip ci]
2024-08-06 23:22:28 +02:00
Niels Dossche
74eff98c84
Deprecate passing incorrect data types for options to ext/hash functions (#15236)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_incorrect_data_types_for_options_to_exthash_functions
2024-08-06 19:13:09 +02:00
Quentin Dreyer
7b32a145d9
Fix GH-15155: Keep stream context in filtered streams
Closes GH-15156
2024-08-06 16:42:33 +01:00
Christoph M. Becker
9c4aa2b4fc
Output diagnostics when SQLFetch with SQL_ERROR
These diagnostics can be useful, and if not for users, at least for the
ext/odbc maintainers.  We only call `odbc_sql_error()` if the previous
`SQLFetch()` or `SQLFetchExtended()` return `SQL_ERROR`, because
otherwise the diagnostic would be unhelpful ("Failed to fetch error
message, SQL state HY000").

Note that the diagnostic is emitted as `E_WARNING` so technically this
is a small BC break.

Closes GH-15256.
2024-08-06 16:59:47 +02:00
Christoph M. Becker
0ca3018887
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix odbc_data_source_001.phpt
2024-08-06 16:55:57 +02:00
Christoph M. Becker
e811bff3bb
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix odbc_data_source_001.phpt
2024-08-06 16:54:58 +02:00
Christoph M. Becker
6713d51631
Fix odbc_data_source_001.phpt
As of PHP 8.1.0, passing `null` to an `int` parameter is deprecated,
and as such the deprecation notice breaks the test.  So we instead pass
an integer, and to avoid hard-coding a value we just add the two
supported constants (which are supposed to have the values `1` and `2`,
respectively).

Closes GH-15254.
2024-08-06 16:54:19 +02:00
David CARLIER
b9da6cb3a2
ext/standard: disable one ipv2long test. (#15200)
atypical leading zeros are accepted on this platform.
2024-08-06 12:26:19 +01:00
Peter Kokot
0c3b7677f9
Autotools: Add pkg-config for GMP library (#15166)
GMP has pkg-config integration since 2019-08-22 (version ~6.2.0).

This optionally finds the GMP library using pkg-config or falls back to
find library on the system or with the provided configure option
argument (--with-gmp=DIR).

When using DIR argument, the pkg-config check is silently skipped.

When not using DIR argument, the GMP_CFLAGS and GMP_LIBS can be also
used to find the GMP library:

        ./configure --with-gmp \
            GMP_CFLAGS=-I/path/to/gmp/include \
            GMP_LIBS="-L/path/to/gmp -lgmp"
2024-08-06 10:16:42 +02:00
Peter Kokot
da5362c9b8
Autotools: Add ext/readline preprocessor macros help texts (#15241)
This adds the missing macros help texts for easier understanding. The
AC_DEFINE can be called with only 2 arguments if there is another
definition in the code where template (see AH_TEMPLATE Autoconf macro)
is read by autoheader (the 2nd AC_DEFINE sets the template for all other
definitions with the same name).
2024-08-06 09:21:58 +02:00
Niels Dossche
bb299a03e9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crash when converting array data for array in shm in xxh3
2024-08-05 22:07:06 +02:00
Niels Dossche
c38c6acfa8
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix crash when converting array data for array in shm in xxh3
2024-08-05 22:07:01 +02:00
Niels Dossche
ca84662c87
Fix crash when converting array data for array in shm in xxh3
Closes GH-15237.
2024-08-05 22:06:11 +02:00
Niels Dossche
a0c29f0889
Use unsigned int instead of int for refcount for libxml objects (#15247) 2024-08-05 22:04:24 +02:00
Niels Dossche
0c7cd92414
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix SoapFault property destruction
2024-08-05 22:04:10 +02:00
Niels Dossche
e681d933d4
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix SoapFault property destruction
2024-08-05 22:03:21 +02:00
Niels Dossche
11fbe8801b
Fix SoapFault property destruction
Two issues:
1) We should not modify the object when we pass invalid values
2) We should reset the properties to their default value otherwise we
   get a UAF.

Regressed in df219ccf9d

Closes GH-15248.
2024-08-05 22:02:51 +02:00
Tim Düsterhus
31e2d2b86c
random: Optimize Randomizer::getBytes() (#15228)
This patch greatly improves the performance for the common case of using a
64-bit engine and requesting a length that is a multiple of 8.

It does so by providing a fast path that will just `memcpy()` (which will be
optimized out) the returned uint64_t directly into the output buffer,
byteswapping it for big endian architectures.

The existing byte-wise copying logic was mostly left alone. It only received an
optimization of the shifting and masking that was previously applied to
`Randomizer::getBytesFromString()` in 1fc2ddc996.

Co-authored-by: Saki Takamachi <saki@php.net>
2024-08-05 19:12:29 +02:00
Peter Kokot
11094d5f24
[skip ci] Fix typo in ext/gd 2024-08-05 16:23:38 +02:00
Peter Kokot
9049d86a78
[skip ci] Fix typo in ext/gd 2024-08-05 16:22:36 +02:00
Peter Kokot
cff39cc400
[skip ci] Fix typo 2024-08-05 16:15:19 +02:00
Peter Kokot
0b25e26b4e
Fix bug #51558: shared readline build fails (#15242)
The 'rl_pending_input' is a variable in Readline library and checking it
with PHP_CHECK_LIBRARY wouldn't find it on some systems.

Library check works on most systems but not on the mentioned AIX in the
bug as it exports variables and functions differently whereas the linker
couldn't resolve the variable as a function.

This should fix the build on systems where this caused issues, such as
AIX.

The <readline/readline.h> is not self-contained header and needs to also
have <stdio.h> included before to have FILE type available. This fixes
the issue on unpatched default readline installations, such as macOS.

Checking this variable ensures that the found library is the correct
library and also that it is of minimum version needed by current PHP
code (https://bugs.php.net/48608).

The library check:

```c
| char rl_pending_input ();
| int main (void) {
|     return rl_pending_input ();
| }
```

The declaration check:

```c
| #include <stdio.h>
| #include <readline/readline.h>
| int main (void) {
| #ifndef rl_pending_input
| #ifdef __cplusplus
|     (void) rl_pending_input;
| #else
|     (void) rl_pending_input;
| #endif
| #endif
| ;
|     return 0;
| }
```

Closes https://bugs.php.net/51558
2024-08-05 15:54:50 +02:00
Peter Kokot
31f256492e
Add and update ext/odbc preprocessor macros help texts (#15223) 2024-08-05 10:12:16 +02:00
Peter Kokot
8bfcbdc5ee
Fix HAVE_LIBGD usage (#15226)
When PHP gd extension uses the external system GD library, the
HAVE_LIBGD preprocessor macro gets defined in Autotools. On Windows it
was previously always defined when bundled library is used. This fixes
the usage and adds help texts.
2024-08-05 09:35:13 +02:00
Peter Kokot
125190186e
Autotools: Check for cross_compiling=yes (#15238)
The cross_compiling variable can initially be "yes", "no", or
"maybe" (when only --host option is added). Autoconf otherwise after
AC_PROG_CC resets it to "no" in such case but to be sure, this
checks for value "yes" instead. The HAVE_FNMATCH template can be also
set after the AC_DEFINE as autoheader scans the templates overall the
source code.
2024-08-05 08:52:09 +02:00
Niels Dossche
d9eb3783bd
Remove DOMImplementation::getFeature() (#15233)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_domimplementationgetfeature_feature_version
2024-08-04 23:30:52 +02:00
Peter Kokot
77ad57c6c6
Add and update ext/dba preprocessor macros help texts (#15221) 2024-08-04 23:23:38 +02:00
Niels Dossche
0aec0faa27
Deprecate DOM_PHP_ERR (#15234)
* Deprecate DOM_PHP_ERR

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_dom_php_err_constant

* Apply suggestions from code review

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

---------

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2024-08-04 22:00:01 +02:00
Peter Kokot
97eb89afd6
Autotools: Improve --with-mm configure option check (#15212)
The mm check code block needs to done only when session is enabled to
prevent redundant mm library linkage in edge case mistakes like:

    ./configure --disable-session --with-mm

CS is synced with AC_* macros. The 'm4_text_wrap' macro joins the given
text with single space characters and limits it to 79 characters width.

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-08-04 21:16:15 +02:00
Niels Dossche
f0b3e3bac7
[ci skip] Fix typo in test file name 2024-08-04 20:32:01 +02:00
Jorg Adam Sowa
b9fef523c1
Deprecate date_sunrise and date_sunset constants (#12978)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 20:07:52 +02:00
Tim Düsterhus
49d0d7bcd7
standard: Stop using php_combined_lcg() in uniqid() (#15217)
Fall back to the fallback generator if the CSPRNG fails instead. This removes
the last internal user of `php_combined_lcg()`.
2024-08-04 18:26:40 +02:00
Tim Düsterhus
6910167c48
random: Remove engine_combinedlcg.c (#15216)
The standalone engine cannot be usefully used for any other purpose. Remove it
and inline the implementation into the `php_combined_lcg()` function.
2024-08-04 18:26:15 +02:00
Tim Düsterhus
e8ff7c70f9
session: Deprecate session.sid_length and session.sid_bits_per_character (#15213)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 18:25:31 +02:00
Tim Düsterhus
f5f9294153
random: Deprecate lcg_value() (#15211)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 18:24:21 +02:00
Tim Düsterhus
ecd11b9687
unserialize: Deprecate the 'S' tag (#12309)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 18:23:19 +02:00
Peter Kokot
d6a75e19d1
Sync preprocessor macros help texts (#15218)
This partially syncs help texts a bit further for:
- ext/ffi
- ext/ldap
- ext/opcache
- ext/pcre
- ext/pdo_mysql
- ext/readline
- ext/standard
2024-08-04 12:52:16 +02:00
Peter Kokot
f16ab75171
Refactor HAVE_SQLDATASOURCES check (#15222)
On Windows, this preprocessor macro is moved to odbc extension, in
Autotools check CS is synced and some basic help text is added.
2024-08-04 11:57:01 +02:00
Peter Kokot
dcdcb3cbfe
Autotools: Replace AC_MSG_ERROR with AC_MSG_FAILURE (#15209)
This replaces the AC_MSG_ERROR with AC_MSG_FAILURE, where appropriate.

The AC_MSG_ERROR outputs given message and exits the configure step. The
AC_MSG_FAILURE does the same but also automatically outputs additional
message "See 'config.log' for more details." which might help directing
the user where to look further.

The AC_MSG_ERROR is used for errors where current test step isn't logged
in the config.log and wouldn't make sense, and AC_MSG_FAILURE is mostly
used in cases of library checks, compilation tests, headers checked with
AC_CHECK_HEADER* and similar tests that are also logged in the
config.log.

AC_MSG_ERROR([Sanity check failed.]) output:

```
configure: error: Sanity check failed.
```

AC_MSG_FAILURE([Sanity check failed.]) output:

```
configure: error: in '/path/to/php-src':
configure: error: Sanity check failed.
See 'config.log' for more details
```
2024-08-04 07:36:37 +02:00
Peter Kokot
cf6bbdfb0c
Autotools: Improve ftp and mysqlnd SSL configure options (#15164)
This makes the configure log messages and help text more intuitive what
is being enabled and when.
2024-08-03 22:13:36 +02:00
Peter Kokot
4f07cdc584
Replace PHP_OUTPUT with AC_CONFIG_FILES (#15186)
This is a follow-up of GH-15177
(c96f08aa70)
and GH-15185
(9467ffb43c)

The PHP_OUTPUT macro was introduced in the very early phase of the build
system due to AC_OUTPUT handling issues in the old Autoconf versions
before the AC_CONFIG_FILES, AC_CONFIG_COMMANDS etc were introduced with
the AC_OUTPUT signature without arguments. The PHP_OUTPUT was also
helping Makefile.in back then being properly generated based on whether
all files were generated or only some (when using the obsolete
CONFIG_FILES=... ./config.status invocation instead of the new
./config.status --file=...). Another issue is that PHP_OUTPUT can't be
used by extensions when using phpize.

This replaces the PHP_OUTPUT invocations with default AC_CONFIG_FILES.

The obsolete "REDO_ALL" feature at the config.status invocation is also
removed with a simpler unconditional generation.

In phar extension the "ext/phar" is replaced with $ext_dir variable to
be able to use phpize.
2024-08-03 21:52:14 +02:00
Peter Kokot
16d9bd0aae
Sync AC_DEFINE help texts (#15207) 2024-08-03 09:47:39 +02:00
Niels Dossche
3ad9f4d441
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15179: Segmentation fault (null pointer dereference) in ext/standard/url_scanner_ex.re
2024-08-03 02:05:44 +02:00
Niels Dossche
9913b83ce5
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15179: Segmentation fault (null pointer dereference) in ext/standard/url_scanner_ex.re
2024-08-03 02:05:35 +02:00
Niels Dossche
67ce8759e8
Fix GH-15179: Segmentation fault (null pointer dereference) in ext/standard/url_scanner_ex.re
Based on analysis by Ilija: https://github.com/php/php-src/issues/15179#issuecomment-2261546902

* Apply suggestions from code review

Closes GH-15206.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-08-03 02:05:06 +02:00
Niels Dossche
e119c72894
Add a test for setting the innerHTML on a prefixed XML element (#15204) 2024-08-03 00:14:04 +02:00
Niels Dossche
76ad89ccff
Fix GH-15192: Segmentation fault in dom extension (html5_serializer)
When cloning a document, doc will not be equal to the actual new
document clone->doc. clone->doc will always point to the correct
document so use that instead when comparing document nodes.

Closes GH-15198.
2024-08-02 18:22:17 +02:00
Ilija Tovilo
85fa983fe6
Add ReflectionProperty::getSettableType() test for get-only backed property
Fix test name while we're at it.
2024-08-02 17:48:08 +02:00
Ilija Tovilo
2e9cc9bc30
Allow optimizer to depend on preloaded symbols (#15021)
* Allow optimizer to depend on preloaded symbols

It is safe for the optimizer to rely on preloaded symbols. This can occur when
compiling non-preloaded files, referencing preloaded ones.

* Disable inline pass for observer test

* Move duplicated code into functions

* Add comment to specific optimization value

* Optimizer should only rely on preloaded symbols in the symbol table

* Fix skipif for windows
2024-08-02 17:35:27 +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
079f82a8ec
Sync CPP macros in ext/iconv (#15191)
This syncs and adds help texts for CPP macros defined when iconv
extension is configured.
2024-08-02 00:49:18 +02:00
Peter Kokot
eed66e6183
Autotools: Fix ffi checks (#15197)
When libffi is installed on non-default places, also the calling
convention checks need adjusted compilation flags to be able to find the
ffi.h header file.
2024-08-02 00:32:36 +02:00
Peter Kokot
28a7c6243c
[skip ci] Add HAVE_XSL_EXSLT help text (#15174) 2024-08-01 00:46:20 +02:00
Tim Düsterhus
a578c27a51
Improve link styling in PHPInfo (#15077)
* Improve link styling in PHPInfo

The previous styling with the fixed background color didn't work well in dark
mode. Remove the background and make links inherit the regular text color. To
make them visually detectable the underlining behavior is reversed. The
underline is now shown when not hovering and hidden when hovering.

* Preserve the headline linking behavior
2024-07-31 12:10:16 +02:00
David CARLIER
b7e43bd2b7
ext/readline: readline_info fix usage when the buffer is not initialised (#15139)
rl_initialise is only called when readline() is used so the global
 buffer might not be initialised yet.
2024-07-31 11:04:44 +01:00
Niels Dossche
3c68661ec9
Minor cleanup in dom_character_data_append_data (#15173) 2024-07-30 23:05:12 +02:00
Niels Dossche
ceca599649
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix UAF when removing doctype and using foreach iteration
2024-07-30 20:07:48 +02:00
Niels Dossche
4049594adf
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix UAF when removing doctype and using foreach iteration
2024-07-30 20:03:30 +02:00
Niels Dossche
b282dd749f
Fix UAF when removing doctype and using foreach iteration
This is an old bug, but this is pretty easy to fix.
It's basically applying the same fix as I did for e878b9f.
Reported by YuanchengJiang.

Closes GH-15143.
2024-07-30 20:01:22 +02:00
Saki Takamachi
60afeb5537
RFC: Change GMP bool cast behavior (#15151)
Implementation of "RFC: Change GMP bool cast behavior"

https://wiki.php.net/rfc/fix_up_bcmath_number_class

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-07-31 00:41:49 +09:00
Peter Kokot
79af1b5280
Autotools: Remove unused variable FREETYPE2_FOUND
Follow-up of 19d8a6b771.
2024-07-30 11:25:24 +02:00
Peter Kokot
8356dadb59
Autotools: Fix xml extension dependency (#15162)
The PHP_ADD_EXTENSION_DEP Autoconf macro needs to be called after
PHP_NEW_EXTENSION to be fully effective. This simplifies the code and
checks. Also, due to the current order_by_dep.awk script implementation
it needs to be on its own line with arguments unquoted so that awk can
parse the config.m4 file. Until order_by_dep.awk script is fixed.
2024-07-30 09:17:11 +02:00
Peter Kokot
0970fd439a
Autotools: Sync CS in enchant extension 2024-07-30 07:54:32 +02:00
Peter Kokot
8c18ae7899
Autotools: Sync CS in bz2 extension (#15163)
- AS_* macros used
- Checking message refactored
2024-07-30 07:52:48 +02:00
Peter Kokot
4d46f26327
Autotools: Update skeleton extension config.m4 template (#15147)
- Comments refactored to a bit more guide way
- Basic help text added to the HAVE_<EXTENSION>* preprocessor macro definitions
- Raw shell ifs replaced with AS_VAR_IF M4 macros
- Code wrapped inside the line length of 80 characters
- pkg-config functionality added on top
- non-pkg-config functionality added afterwards
- The loop refactored a bit with a break and check message done
  afterwards

[skip ci]
2024-07-30 00:48:19 +02:00
Dmitry Stogov
53b329e278
Fix GH-15101: _ir_RSTORE: Assertion `ctx->control' (#15153) 2024-07-29 19:17:25 +03:00
Saki Takamachi
28080dce62
round(): Corrected test name and fixed UPGRADING (#14943)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-07-29 20:39:35 +09:00
Peter Kokot
7fd54f9d12
Remove duplicate ZEND_ENABLE_STATIC_TSRMLS_CACHE flag (#15080) 2024-07-29 10:17:23 +02:00
Peter Kokot
9ea290b72b
Sync HAVE_ICONV preprocessor macro usage (#15148)
HAVE_ICONV marks that PHP extension 'iconv' is available, and not only
that iconv library or its functions/headers are available.
2024-07-29 10:12:57 +02:00
Peter Kokot
7d927075ea
Autotools: Sync shared argument CS (#15141)
The 3rd argument of the PHP_NEW_EXTENSION can be "shared" or "yes" to
mark the extension as shared, or anything else to mark that extension as
not shared. This syncs the argument values across the build system to be
"no" as in other always-enabled extensions.
2024-07-29 10:12:32 +02:00
Peter Kokot
9cc63e1de9
Autotools: Normalize headers arguments (#15149)
Refactor all "long" arguments into blank-or-newline-separated list of
files with m4_normalize.
2024-07-29 10:08:17 +02:00
Peter Kokot
f3c48f1acd
Autotools: Append hash and opcache build directories (#15132)
When building in out-of-source directory, instead of creating these
build directories right away, this appends them to the list and creates
them at the end of configure phase. These don't need to be created
immediately as no files are generated in these extensions before the
configure phase is finished.

Also, the PHP_ADD_BUILD_DIR is moved after the PHP_NEW_EXTENSION when
the more common $ext_builddir variable is available (the ext/<extension>
isn't available when building with phpize).
2024-07-29 10:02:11 +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
Pol Dellaiera
664c1d18df
Fix: add missing PHPAPI (#15142)
Issue introduced in commit 5905857fd2 from PR https://github.com/php/php-src/pull/14833
2024-07-28 20:38:52 +02:00
Niels Dossche
e0a2e2e59c
Fix GH-15123: var_dump doesn't actually work on XMLReader (#15130) 2024-07-28 19:36:07 +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
David Carlier
a7d856d9bf
ext/readline: fix global readline vars when updating rl_line_buffer.
if the new value was larger, rl_line_buffer_length was never updated.
neither was rl_end (on unixes).

close GH-15120
2024-07-28 14:12:26 +01:00
Niels Dossche
177fd88452
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix CI failure on macOS after Curl update
2024-07-28 14:34:47 +02:00
Niels Dossche
9f570163b3
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix CI failure on macOS after Curl update
2024-07-28 14:34:35 +02:00
Niels Dossche
fdae7c23f0
Fix CI failure on macOS after Curl update 2024-07-28 14:34:26 +02:00
Gina Peter Banyard
a50adda19e
ext/gmp: Make GMP class final (#15121)
* ext/gmp: Make GMP class final

RFC: https://wiki.php.net/rfc/gmp-final

* Update UPGRADING

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

---------

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-07-28 13:03:26 +01:00
Niels Dossche
9d7e6090df
Fix GH-15137: Unexpected null pointer in Zend/zend_smart_str.h (#15138)
This regressed when I optimized $wholeText. The previous code used xmlStrcat
which implicitly checked for a NULL argument, but now it's a direct memcpy
which you shouldn't pass null pointers to, although it won't result in a
crash because memcpy doesn't do anything if the length is 0.
2024-07-28 13:53:30 +02:00
Peter Kokot
dee29442ba
Autotools: Fix ext/standard sources (#15131)
This appends source files to the PHP_NEW_EXTENSION call and adds the
possible compilation flag -DZEND_ENABLE_STATIC_TSRMLS_CACHE when
building objects as done on all ext/standard sources already. Also, the
PHP_EXT_DIR Autoconf macro doesn't accept any argument.
2024-07-28 10:12:17 +02:00
Peter Kokot
590786adb3
Autotools: Replace PHP_EXT_DIR with $ext_dir (#15133)
- Sync Autoconf syntax
- The PHP_EXT_DIR macro doesn't accept any arguments and since this is
  called after PHP_NEW_EXTENSION, the $ext_dir variable can be used
  instead.
2024-07-28 10:09:26 +02:00
Peter Kokot
32210ce967
Autotools: Sync CS in XML related extensions (#15110)
- PHP_SETUP_LIBXML arguments quoted
- Help texts updated for HAVE_LIBXML, HAVE_DOM, HAVE_XMLREADER,
  HAVE_XMLWRITER, HAVE_SOAP, HAVE_SIMPLEXML, and HAVE_XML CPP macros
- Duplicate HAVE_LIBXML symbol definition in PHP_SETUP_LIBXML M4 macro
  removed (the HAVE_LIBXML marks that PHP libxml extension is available and
  not only that libxml2 library is available)
2024-07-27 22:48:51 +02:00
Niels Dossche
5270ada34c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix nightly failure in test variation due to number of temp variables varying when observers are enabled
2024-07-27 16:37:14 +02:00
Niels Dossche
950d010cc5
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix nightly failure in test variation due to number of temp variables varying when observers are enabled
2024-07-27 16:37:09 +02:00
Niels Dossche
4df858602a
Fix nightly failure in test variation due to number of temp variables varying when observers are enabled 2024-07-27 16:37:01 +02:00
Niels Dossche
cf14adf897
Avoid string duplications in simplexml (#15122)
Switch to zend_string which allows us to use zend_string_copy.
2024-07-27 16:21:07 +02:00
Niels Dossche
043a1cb856
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix CI failure after Curl update (#15124)
2024-07-27 16:11:33 +02:00
Niels Dossche
014e515ccc
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix CI failure after Curl update (#15124)
2024-07-27 16:11:26 +02:00
Niels Dossche
404bd30810
Fix CI failure after Curl update (#15124) 2024-07-27 16:09:50 +02:00
Peter Kokot
ef8e792962
Autotools: Quote M4 macro arguments
- AC_CHECK_TYPES
- AC_REPLACE_FUNCS
- PHP_HELP_SEPARATOR needs here double quotes as content contains '['
  and ']' characters
2024-07-27 11:22:28 +02:00
Peter Kokot
a1b45bb87a
Autotools: Sync PHP_SETUP_* M4 macros (#15117)
- arguments quoted
- MYSQLND_HAVE_SSL help text synced
2024-07-27 11:20:07 +02:00
Peter Kokot
c53b272f67
Autotools: Quote AC_CHECK_LIB arguments (#15116)
This syncs CS for AC_CHECK_LIB where possible, and adds minor help texts
to gettext extension AC_DEFINE symbols, including the HAVE_LIBINTL.
2024-07-27 11:18:52 +02:00
Peter Kokot
a7f0fe1f33
Autotools: Quote macro arguments
- PHP_EXPAND_PATH
- PHP_LIBGCC_LIBPATH
- PHP_OUTPUT
- PHP_REMOVE_USR_LIB
2024-07-27 05:26:32 +02:00
David CARLIER
bb8d667f8f
Fix GH-15102: ext/pgsql use after free on persistent connection renewal. (#15115)
simplifying the workflow by just using PQreset which force a new
connection internally, connection process ids ought to be different,
 and let the existing checks do the rest.
2024-07-26 23:12:26 +01:00
Peter Kokot
2141094b2a
Autotools: Fix rl_erase_empty_line check (#15109)
When building with readline/libedit installed at non-standard or
non-system paths the check flags also need to be adjusted a bit to be
able to check for the declared variable.
2024-07-26 23:28:25 +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
Christoph M. Becker
af789afbe8
Fix type incompatibility in assignment.
This partially reverts 0956267c08, which
introduced a type incompatibility where an `int` function is assigned
to a `zend_result` function.  That yields a level 1 C4133 warning on
MSVC, and usually (e.g. in CI) level 1 warnings are elevated to errors,
so the build fails.[1]

The PHP-8.3 branch and up are uneffected by this, so the upward merges
should be empty.

[1] <0956267c08 (r144587696)>
2024-07-26 14:57:16 +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
Niels Dossche
ad452086d9
Add tidyNode::getNextSibling() and tidyNode::getPreviousSibling()
These get the next and previous sibling nodes, respectively.
We can already kind of do this by using the $child array, but that's
inconvenient when actually walking the tree by only using node
instances. Since the class is final, there is no BC break here.

Closes GH-15047.
2024-07-25 13:55:20 +02:00
Ilija Tovilo
a0a8624346
Fix throw in IS_IDENTICAL in JIT (#15103)
We need to persist opline in case zend_is_identical() throws.
2024-07-25 13:18:47 +02:00
Christoph M. Becker
da72ac11f6
Fix GH-15094: php_random_default_engine() is not C++ conforming
Using compound literals is conforming to C99 (and up), but not with any
C++ standard.  Since the code is in a public header, it might be used
by C++ extensions.  Unfortunately, we cannot even used designated
initializers, because these are a C++20 feature, so we stick with
classic C/C++ code.

Closes GH-15100.
2024-07-25 12:44:25 +02:00
Peter Kokot
82e63a06e2
Add pcre dependency as required to ext/filter (#15099)
This is configure phase dependency synced with already present Autotools
pcre dependency check.
2024-07-24 23:30:57 +02:00
Peter Kokot
b0db5e76a0
Autotools: Normalize ext/mbstring installed headers (#15097)
This uses the default PHP_INSTALL_HEADERS macro instead of a wrapper,
making this in tune with the rest of the extensions.
2024-07-24 22:41:16 +02:00
Peter Kokot
ce8ffedccf
Autotools: Normalize ext/fileinfo sources (#15082) 2024-07-24 19:55:37 +02:00
Peter Kokot
d22abb5fa9
Autotools: Quote PHP_NEW_EXTENSION arguments (#15081)
This removes redundant shell double quotes as PHP_NEW_EXTENSION macro
already wraps the flags argument in quotes.
2024-07-24 19:55:19 +02:00
Peter Kokot
da69755eca
Autotools: Sync CS in opcache Capstone check (#15084)
- Added Capstone check message in configure log
- PKG_CHECK_MODULES already errors out by default if Capstone is not
  found with a bit more informative message
- Autoconf syntax used
- HAVE_CAPSTONE help text synced and updated
2024-07-24 19:55:01 +02:00
Peter Kokot
e3c1e3326c
Autotools: Normalize ext/opcache sources (#15083)
- m4_normalize can simplify the list of source files
- PHP_NEW_EXTENSION arguments quoted and excessive shell double quotes
  character removed (macro already adds double quotes)
- Removed redundant shell variable parameter expansions
- Minor Autoconf CS syncs
2024-07-24 18:59:13 +02:00
Christoph M. Becker
58ac56f4bb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15087 IntlChar::foldCase()'s $option is not optional
2024-07-24 16:48:44 +02:00
Christoph M. Becker
ce25be5223
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15087 IntlChar::foldCase()'s $option is not optional
2024-07-24 16:47:03 +02:00
Christoph M. Becker
5fbda73099
Fix GH-15087 IntlChar::foldCase()'s $option is not optional
Since that parameter is supposed to be optional (and has been prior to
PHP 8.0.0), we fix the implementation instead of the stub.

Closes GH-15091.
2024-07-24 16:45:20 +02:00
Christoph M. Becker
6727f548b0
Port "gd2: use existing overflow2() rather than ad-hoc version" (#15090)
We port this modification[1] from libgd into our bundled libgd, because
the change makes sense, and we want the code bases to stay in sync as
close as possible.

We also apply a quick fix to the respective test.

[1] <f0a059be6c>
2024-07-24 14:18:36 +02:00
Ilija Tovilo
8b6f14a9a2
Compile in opcache without COMPILE_IGNORE_INTERNAL_CLASSES (#15025) 2024-07-24 13:07:28 +02:00
Peter Kokot
40cf2e1279
Autotools: Normalize pcre sources (#15085) 2024-07-24 01:53:51 +02:00
Peter Kokot
6cdff7573a
Autotools: Normalize ext/gd sources (#15086) 2024-07-24 01:52:51 +02:00
Levi Morrison
9d25296723
Merge branch 'PHP-8.3' 2024-07-23 16:34:16 -06:00
Levi Morrison
e43d9c7469
Merge branch 'PHP-8.2' into PHP-8.3 2024-07-23 16:33:40 -06:00
Levi Morrison
0956267c08
Fix warnings in session/spl
This fixes -Winline errors where the functions are not ever inlined.

Also fixes some signature mismatches which were fixed previously but
for whatever reason were not ported to all maintained branches:

/usr/local/src/php/ext/session/session.c:1299:20:
warning:conflicting types for 'php_session_send_cookie' due to enum/integer mismatch;
have 'zend_result(void)' {aka 'ZEND_RESULT_CODE(void)'} [-Wenum-int-mismatch]
 1299 | static zend_result php_session_send_cookie(void) /* {{{ */
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/php/ext/session/session.c💯12:
note: previous declaration of 'php_session_send_cookie' with type 'int(void)'
  100 | static int php_session_send_cookie(void);
      |            ^~~~~~~~~~~~~~~~~~~~~~~
2024-07-23 16:25:11 -06:00
Arnaud Le Blanc
e63f822e6a
Fix test on alpine/musl (#15072)
When libxml uses musl iconv, GBK encoding is not supported as a target encoding
2024-07-23 16:07:26 +02:00
Simonov Denis
00e45887fa
PDO_Firebird: Supported Firebird 4.0 datatypes (#14897)
Five new data types are now available: INT128, DEC16, DEC34, TIMESTAMP_TZ, TIME_TZ.
These are available starting with Firebird 4.0.

closes #14897
2024-07-23 22:34:21 +09:00
Arnaud Le Blanc
d4ef8b97f5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix build on platforms without JIT support (#15069)
2024-07-23 13:43:25 +02:00
Arnaud Le Blanc
385151d200
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix build on platforms without JIT support (#15069)
2024-07-23 13:43:13 +02:00
Arnaud Le Blanc
acf758d2ea
Fix build on platforms without JIT support (#15069) 2024-07-23 13:42:47 +02:00
Peter Kokot
518939a08c
Autotools: Normalize ext/dom sources (#15073) 2024-07-23 01:45:57 +02:00
David Carlier
e1c8a85244
Merge branch 'PHP-8.3' 2024-07-22 23:26:40 +01:00
David Carlier
2599b6e780
Merge branch 'PHP-8.2' into PHP-8.3 2024-07-22 23:26:28 +01:00
David Carlier
350c10d985
fix GH-14785 pedantic error
close GH-15071
2024-07-22 23:26:09 +01:00
David Carlier
c8440343cd
Merge branch 'PHP-8.3' 2024-07-22 22:58:54 +01:00
David Carlier
5bac3c27c9
Merge branch 'PHP-8.2' into PHP-8.3 2024-07-22 22:58:18 +01:00
David Carlier
ba909d7c43
Fix GH-14780: p(f)sockopen overflow on timeout argument.
close GH-14785
2024-07-22 22:57:59 +01:00
Peter Kokot
40e0d3a276
Autotools: Check for crypt and crypt_r with AC_* macros (#15060)
This checks if crypt and crypt_r functions are available on the system
in default libraries or in the crypt library with the AC_SEARCH_LIBS.
The redundant HAVE_LIBCRYPT symbol is removed.
2024-07-22 21:51:18 +02:00
Peter Kokot
499ea9067d
Sync required phar dependencies (#15058)
Required extensions hash and spl are added to the configure phase as
required. They are also already noted as ZEND_MOD_REQUIRED.
2024-07-22 21:30:15 +02:00
David Carlier
21418b5bb5
ext/intl: SpoofChecker::setAllowedChars support.
To limit the acceptable range of acceptable unicode chars via individual
ones or via a pattern.
2024-07-22 19:52:56 +01:00
Arnaud Le Blanc
c60dbecb69
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Hint the opcache shm mapping location only when JIT is enabled
  Fix the JIT buffer relocation failure at the corner case (#11266)
2024-07-22 19:28:52 +02:00
Arnaud Le Blanc
ead61c7f29
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Hint the opcache shm mapping location only when JIT is enabled
  Fix the JIT buffer relocation failure at the corner case (#11266)
2024-07-22 19:28:05 +02:00
Arnaud Le Blanc
929536b697
Hint the opcache shm mapping location only when JIT is enabled
Closes GH-14793
Fixes GH-13775
2024-07-22 19:26:54 +02:00
LoongT4o
a924e1c71b
Fix the JIT buffer relocation failure at the corner case (#11266)
Avoid missing possible candidates due to the large address range of the free segment.
Eg, 

48000000-49400000 r-xs 08000000 00:0f 39322841               segment1
7ffff2ec8000-7ffff2f49000 rw-p 00000000 00:00 0              segment2
7ffff6fae000-7ffff735c000 r-xp 00200000 08:02 11538515       /usr/local/sbin/php-fpm

original code will miss the opportunity between [7ffff2ec** - 7ffff2ec8000].

Fix issue #11265.

Signed-off-by: Long, Tao <tao.long@intel.com>
Signed-off-by: Dmitry Stogov <dmitrystogov@gmail.com>
2024-07-22 19:17:43 +02:00
Niels Dossche
810999ae31
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bogus fallthrough path in firebird_handle_get_attribute()
2024-07-22 18:33:41 +02:00
Niels Dossche
46924ac9fa
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bogus fallthrough path in firebird_handle_get_attribute()
2024-07-22 18:33:32 +02:00
Niels Dossche
b8e9c5ba6a
Fix bogus fallthrough path in firebird_handle_get_attribute()
If getting the version fails, we should return -1 according to
php_pdo_driver.h:259, not fall through to another attribute.

Closes GH-15066.
2024-07-22 18:33:03 +02:00
Bob Weinand
e406ec81f4 Merge branch 'PHP-8.3' 2024-07-22 18:32:04 +02:00
Bob Weinand
61b455b59c Merge branch 'PHP-8.2' into PHP-8.3 2024-07-22 18:30:10 +02:00
Bob Weinand
a18df90a8b Fix GH-13817: Segmentation fault for enabled observers after pass 4
Instead of fixing up temporaries count in between observer steps, just apply the additional temporary in the two affected observer steps.

Closes GH-14018.
2024-07-22 18:28:03 +02:00
Saki Takamachi
f4391d4d2c
Fixed segmentation fault when attribute value was not set (#15065) 2024-07-23 01:17:21 +09:00
Niels Dossche
543c4bb7bc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix passing non-finite timeout values in stream functions
2024-07-22 17:53:00 +02:00
Niels Dossche
a0e1e085d8
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix passing non-finite timeout values in stream functions
2024-07-22 17:52:53 +02:00
Niels Dossche
fdcfd62b9b
Fix passing non-finite timeout values in stream functions
Closes GH-15061.
2024-07-22 17:52:21 +02:00
Niels Dossche
77f870e98e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14286 (ffi enum type (when enum has no name) make memory leak)
2024-07-22 17:45:28 +02:00
Niels Dossche
b2963e96ee
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14286 (ffi enum type (when enum has no name) make memory leak)
2024-07-22 17:45:20 +02:00
Niels Dossche
c0de7214aa
Fix GH-14286 (ffi enum type (when enum has no name) make memory leak)
For top-level anonymous type definition we never store the declaration anywhere
else nor the type anywhere else.
The declaration keeps owning the type and it goes out of scope.
For anonymous fields this gets handled by the add_anonymous_field code that
removes the type from the declaration.
This patch does something similar in the parsing code when it is
detected we're dealing with an anonymous enum in a top-level declaration.

Closes GH-14839.
2024-07-22 17:44:47 +02:00
Dmitry Stogov
e4d86998f6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix Windows build
2024-07-22 16:41:43 +03:00
Dmitry Stogov
0338e8d4ec
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix Windows build
2024-07-22 16:41:35 +03:00
Dmitry Stogov
d6efff7254
Fix Windows build 2024-07-22 16:41:16 +03:00
Dmitry Stogov
037da5941c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Regenerate FFI parser using HEAD version of LLK
2024-07-22 16:02:12 +03:00
Dmitry Stogov
eb7bb586e2
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Regenerate FFI parser using HEAD version of LLK
2024-07-22 16:01:59 +03:00
Dmitry Stogov
13e9b40517
Regenerate FFI parser using HEAD version of LLK 2024-07-22 16:01:26 +03:00
Saki Takamachi
8a4a30469a
Zend: Add ZEND_BYTES_SWAP32/ZEND_BYTES_SWAP64 (#14910) 2024-07-22 17:57:16 +09:00
Peter Kokot
fe9fdd4fc3
Autotools: Fix unused result and variables warnings in flush IO check (#15056)
- exit() replaced with regular return since these two behave the same in
  main()
- main(void) used as argc and argv aren't used
- if sentences wrapped in curly brackets for readability
- fgets wrapped in if to check for the return result and omit the
  "ignoring return value of 'fgets' declared with attribute
  'warn_unused_result'..." warnings in the config.log
- fclose(fp) added before returning
2024-07-22 10:00:14 +02:00
Dmitry Stogov
7b25cac32b
Update IR
IR commit: 8fb33ceccd39d0052c5949cf96fc135e7ba1fbcb
2024-07-22 09:43:11 +03:00
Peter Kokot
9f74329bb6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Append -Wno-implicit-fallthrough flag conditionally (#13331)
2024-07-22 07:02:25 +02:00
Peter Kokot
f702437cad
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Append -Wno-implicit-fallthrough flag conditionally (#13331)
2024-07-22 06:58:01 +02:00
Peter Kokot
d20d11375f
Append -Wno-implicit-fallthrough flag conditionally (#13331)
Older GCC versions (< 7.0) don't support the -Wno-implicit-fallthrough
compiler flag. This adds the flag conditionally in case some other
compiler will run into same issue.

Fixes GH-13330
2024-07-22 06:57:04 +02:00
Niels Dossche
af830d866f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15034: Integer overflow on stream_notification_callback byte_max parameter with files bigger than 2GB
2024-07-21 22:03:06 +02:00
Niels Dossche
c26d1a36e2
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15034: Integer overflow on stream_notification_callback byte_max parameter with files bigger than 2GB
2024-07-21 22:02:47 +02:00
Niels Dossche
cfcc2a3fda
Fix GH-15034: Integer overflow on stream_notification_callback byte_max parameter with files bigger than 2GB
We were using atoi, which is only for integers. When the size does not
fit in an integer this breaks. Use ZEND_STRTOUL instead. Also make sure
invalid data isn't accidentally parsed into a file size.

Closes GH-15035.
2024-07-21 22:02:11 +02:00
Niels Dossche
9b78e5ff1c Remove useless return 2024-07-21 18:36:19 +02:00
Niels Dossche
186788f149 Fix error handling in tidy constructor 2024-07-21 18:36:19 +02:00
Niels Dossche
1d045a5c97 Use RETVAL_BOOL or RETURN_BOOL in ext/tidy 2024-07-21 18:36:19 +02:00
Niels Dossche
09c0455f64 Consistently check zend_result in the same way 2024-07-21 18:36:19 +02:00
Niels Dossche
e736d7cd8a Make more pointers const in ext/tidy 2024-07-21 18:36:19 +02:00
Niels Dossche
c952f5625a
Update Lexbor
Upstream commit 48afb625af9178d1929ec81349f173116b136310.
2024-07-21 18:08:59 +02:00
Niels Dossche
9435f4d55b
Throw instead of silently failing when creating a too long text node
Lower branches suffer from this as well but we cannot change the
behaviour there.
We also add NULL checks to check for allocation failure.

Closes GH-15014.
2024-07-21 17:08:06 +02:00
Niels Dossche
c4e1f2b4e8
Factor out object creation code in ext/tidy 2024-07-21 17:01:47 +02:00
Niels Dossche
551c4a3bf8
Use OBJ_RELEASE instead of ZVAL_OBJ + zval_ptr_dtor in php_dom.c (#15052) 2024-07-21 16:57:05 +02:00
Niels Dossche
d14b936d4f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leaks in ext/tidy basedir restriction code
2024-07-21 16:28:51 +02:00
Niels Dossche
74de766d41
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix memory leaks in ext/tidy basedir restriction code
2024-07-21 16:28:45 +02:00
Niels Dossche
8de7ccb29b
Fix memory leaks in ext/tidy basedir restriction code
TIDY_APPLY_CONFIG can early return because it's a macro, but then the
cleanup paths are not executed. Transform this to a real function and
handle the cleanups correctly at the callsites.

Closes GH-15046.
2024-07-21 16:28:15 +02:00
Niels Dossche
d5faf44e90
Remove bogus tree setting code from parentnode/tree.c (#15044)
I don't know why this code was here in the first place, it is present
since the initial implementation. It doesn't make sense because:
1. It would require updating the refcounts if the document wasn't
   actually already set.
2. We enforce that the document is the same as the target document by
   this point, so setting the tree is pointless.
2024-07-21 13:53:12 +02:00
Peter Kokot
c4546d4923
Autotools: Sync CS in ext/standard process check (#15049)
- AC_* macros simplified and arguments quoted
2024-07-21 08:38:06 +02: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
David Carlier
ba54cebb44
ext/pgsql: pg_convert/pg_insert/pg_update/pg_delete caching regexes.
Close GH-15039
2024-07-20 23:04:48 +01:00
Niels Dossche
2cfcfe09a0
Convert more common methods in dom/node.c to fast ZPP (#15043) 2024-07-20 20:20:32 +02:00
Niels Dossche
29466223d0 Move stricterror fetch to dom_child_removal_preconditions() body 2024-07-20 20:01:55 +02:00
Niels Dossche
74116a4ade Remove impossible condition
The parent's child must exist because otherwise this node could not have
a parent node.
2024-07-20 20:01:55 +02:00
Saki Takamachi
1fc2ddc996
random: Optimize Randomizer::getBytesFromString() (#14894)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-07-20 15:42:47 +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
David CARLIER
39b1006306
ext/pgsql: db metadata simplification for table names. (#15036) 2024-07-19 22:47:52 +01:00
Calvin Buckley
a63fd2a95a
Gate SOCK_DCCP behind its own ifdef (#15031)
AIX 7.1 has SOCK_CONN_DGRAM, but not SOCK_DCCP; the previous change
conflated the availability between the two definitions. Add an
additional #ifdef for this.
2024-07-19 16:41:29 -03:00
Peter Kokot
6857c7c8d6
Autotools: Expand m4_normalize sooner (#15018)
Quoted m4_normalize will expand and change its argument later in the
macro call when M4 is processing the *.m4 sources. Without quotes the
already normalized string is passed to the macro directly. In these
specific cases generated configure script is the same. This is more for
consistency to have this synced and not repeat the pattern too much
in the future when copy/pasting. Note, that many AC_* macros require
similar behavior already (for example, AC_CHECK_FUNCS.)
2024-07-19 15:20:04 +02:00
Niels Dossche
442ae96444
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15028: Memory leak in ext/phar/stream.c
  Fix GH-15023: Memory leak in Zend/zend_ini.c
  Fix GH-15020: Memory leak in Zend/Optimizer/escape_analysis.c
2024-07-19 14:59:57 +02:00
Niels Dossche
f21947a7ae
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15028: Memory leak in ext/phar/stream.c
  Fix GH-15023: Memory leak in Zend/zend_ini.c
  Fix GH-15020: Memory leak in Zend/Optimizer/escape_analysis.c
2024-07-19 14:59:44 +02:00
Niels Dossche
5996227f88
Fix GH-15028: Memory leak in ext/phar/stream.c
Closes GH-15029.
2024-07-19 14:58:28 +02:00
Arnaud Le Blanc
1fbb666545
Use zend_std_build_properties() to access zend_object.properties
The zend_object.properties HashTable needs to be built just in time by calling
rebuild_object_properties() on the object before accessing it. Normally this is
done automatically in zend_std_get_properties(), but we do it manually in a few
places.

In this change I introduce an inline variant of zend_std_build_properties(), and
refactor these places to use it instead of calling rebuild_object_properties()
manually.

rebuild_object_properties() renamed as rebuild_object_properties_internal(), to
enforce usage of zend_std_get_properties() or zend_std_build_properties_ex().

Closes GH-14996
2024-07-18 22:18:38 +02:00
Niels Dossche
80a4783d25
Deduplicate NULL checks in ext/dom (#15015)
This introduces a new helper php_dom_create_nullable_object() that does
the NULL check and puts NULL in return_value. Otherwise it runs
php_dom_create_object(). This deduplicates a bit of code.
2024-07-18 21:20:03 +02:00
Niels Dossche
27205bd3c3
Cleanup DOMAttr::isId() (#15016) 2024-07-18 21:19:54 +02:00
Tim Düsterhus
5905857fd2
RFC: Add the RoundingMode enum (#14833)
see https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum

Co-authored-by: Saki Takamachi <saki@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-18 20:44:30 +02:00
Niels Dossche
81da53fccd
Convert forgotten efree to zend_string_release
Follow-up for 2d029efd94
2024-07-18 17:32:50 +02:00
Niels Dossche
2d029efd94
Avoid duplicating the filename string when profiling in XSL (#15010) 2024-07-18 17:27:53 +02:00
Niels Dossche
a59103feed
Fix trampoline leak in xpath callables
Closes GH-15009.
2024-07-18 16:54:46 +02:00
Niels Dossche
5471f3d922
Don't open-code string value accesses in xpath (#15007) 2024-07-18 15:22:44 +02:00
Gina Peter Banyard
efe4e6d38e
ext/spl: Add ArrayObject test with property hooks (#15005)
As expected, ArrayObject is cursed
2024-07-18 13:10:00 +01:00
Niels Dossche
b05de66a3a
Optimize ext/dom $wholeText (#15001)
Use our own string builder instead of using libxml's and then having to
copy over.

For the following test:
```
$dom = Dom\HTMLDocument::createEmpty();
$root = $dom->appendChild($dom->createElement('root'));
$root->append('abc', 'def', 'ghi');
$f = $root->firstChild;

for ($i = 0; $i < 1000000; $i++)
	$f->wholeText;
```

The following results were obtained on an i7-4790:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):      57.2 ms ±   2.3 ms    [User: 53.2 ms, System: 3.4 ms]
  Range (min … max):    54.7 ms …  69.3 ms    52 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):      89.4 ms ±   3.4 ms    [User: 85.6 ms, System: 3.0 ms]
  Range (min … max):    86.1 ms … 105.8 ms    32 runs

Summary
  ./sapi/cli/php x.php ran
    1.56 ± 0.09 times faster than ./sapi/cli/php_old x.php
```
2024-07-18 12:57:23 +02:00