Commit Graph

14946 Commits

Author SHA1 Message Date
Pierrick Charron
473cbdf558
[skip ci] Update NEWS 2024-06-05 09:00:31 -04:00
Calvin Buckley
3e3e3b33f8 [skip ci] update NEWS for GH-14457 2024-06-04 12:49:02 -03:00
nielsdos
644d3628e3
Fix GH-11188: Error when building TSRM in ARM64
Although the issue mentioned FreeBSD, this is a broader problem:
the current ARM64 code to load the TLS offset assumes a setup with
the non-default TLS model. This problem can also apply on some
configurations on other platforms.

Closes GH-11236.
2024-06-03 20:28:55 +02:00
Niels Dossche
5ec26edfb6
Fix reference handling in SpoofChecker
Closes GH-14414.
2024-06-01 20:35:57 +02:00
Niels Dossche
1b1677a8f1
Fix bug #76232: SoapClient Cookie Header Semicolon
According to RFC 6265 [1] the cookies must be separated by "; " not ";",
and it must not end with ";".

[1] https://datatracker.ietf.org/doc/html/rfc6265

Closes GH-14406.
2024-06-01 17:37:30 +02:00
Niels Dossche
476706165a
Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)
There's a hash table that maps type names to class name, but names with
a leading backslash are not supported. The engine has logic to strip
away the leading backslash that we should replicate here.

It works by checking if we need to make an actual copy in case an
unexpected (e.g. invalid data or leading backslash) situations are
detected. Upon making a copy we normalize the data in the table.

Furthermore, previously the code assumed that the key was always valid
and that the structure was a non-packed hash table. This isn't
necessarily the case. The new code fixes this as well.

Closes GH-14398.
2024-06-01 13:29:26 +02:00
Bob Weinand
be7f3aa474 Fix GH-14387: Crash when stack walking in destructor of yielded from values during Generator->throw() 2024-06-01 02:38:55 +02:00
Niels Dossche
18233e0f2e
Fix memory leaks with string function name lookups
There's a few leaks where the string is copied for lowercasing but not released.
Where possible, use the _lc functionality of zend_hash to do the lookup
to avoid the leaks that currently exist with the manual lowercasing.

Closes GH-14390.
2024-05-31 21:22:37 +02:00
Niels Dossche
89c4db9c22
Fix reading zlib ini settings in ext-soap
zend_ini_long() actually expects the length without the NUL byte, but
we're passing the length *with* the NUL byte. This mess can actually be
avoided altogether by using INI_INT, so use that instead.

Closes GH-14382.
2024-05-31 18:21:34 +02:00
Niels Dossche
23912f55eb
Fix memory leak if calling SoapServer::setClass() twice
Closes GH-14381.
2024-05-31 18:21:00 +02:00
Niels Dossche
51bb9c2c2a
Fix memory leak if calling SoapServer::setObject() twice
Closes GH-14380.
2024-05-31 18:20:37 +02:00
Niels Dossche
6aa66e0806
Fix missing error restore code in ext-soap (#14379)
The begin and end macros should be paired, but some of the end macro
calls were missing.
2024-05-31 18:19:00 +02:00
Niels Dossche
c815cdcfe7
Partially backport GH-13782 to stable branches
This partially backports that PR to stable branches as it has been in master
without reported problems so far.
It's only a partial backport because the stable branches don't have the
ZTS persistent resource fix that would fix shutdown crashes, i.e. the
code change in mysqlnd_vio's close_stream is not backported.

This is fully fixed on master.

Closes GH-14324.
Closes GH-10599.
2024-05-30 20:58:54 +02:00
Gina Peter Banyard
709869c8bd
ext/bcmath: Fixed bug (bcpowmod() with mod = -1 returns 1 when it must be 0) 2024-05-30 15:47:25 +01:00
Niels Dossche
88ff32a25b
Fix GH-14343: Memory leak in xml and dom (#14347)
If there is no root, the namespace cannot be attached to it,
so we have to attach it to the old list.

This isn't a problem in "new DOM" because namespaces are managed in a
separate structure there.
2024-05-29 17:49:07 +02:00
Arnaud Le Blanc
79862f24da
Fix TLS access in JIT on FreeBSD/amd64
DTV elements are 8 bytes in size a per ABI [1], and the index is offset by 1
on FreeBSD [2]

[1] http://people.redhat.com/drepper/tls.pdf
[2] bf56e8b9c8/libexec/rtld-elf/rtld.c (L5260)

Closes GH-13928
2024-05-28 15:42:57 +02:00
Manuel Kress
272da51bfd
Use ITIMER_REAL for timeout handling on MacOS / Apple Silicon system
setitimer(ITIMER_PROF) fires too early on MacOS 14 when running on Apple
Silicon. See https://openradar.appspot.com/radar?id=5583058442911744.

Fixes GH-12814
Closes GH-13567
2024-05-28 15:25:46 +02:00
Niels Dossche
35e62e9b59
Fix bug #47925: PHPClient can't decompress response (transposed uncompress methods?)
The incorrect functions are being called to deal with incoming
compressed data.
gzip/x-gzip corresponds to gzuncompress(), while deflate corresponds to
gzinflate().

The existing code for gzip compression also plays with removing the
first 10 bytes (i.e. the gzip header) to pass it to the inflate
implementation but that doesn't always work properly due to trailer
data. Get rid of that entirely by using the correct functions.

Closes GH-14321.
2024-05-27 19:23:40 +02:00
Peter Kokot
9e226b2881
Fix incompatible pointer type warnings
This fixes the incompatible pointer type warnings when checking for
reentrant functions declaractions (-Wincompatible-pointer-types) in
config.log. These were not declared on some obsolete systems if
_REENTRANT was not defined. The check is for now left in the code base
but can be transitioned to newer code without checking for missing
declarations or using these otherwise in the future.

Closes GH-14315.
2024-05-24 20:57:52 +02:00
Niels Dossche
a2c5b4ec05
Fix GH-14307: Test curl_basic_024 fails with curl 8.8.0
Curl changed the behaviour, from the changelog:
  - lib: make protocol handlers store scheme name lowercase curl/curl@c294f9c

From the docs: "The returned scheme might be upper or lowercase. Do
comparisons case insensitively."

Closes GH-14312.
2024-05-24 14:41:29 +02:00
Niels Dossche
4da46107c4
Fix memory leaks in ext/sodium on failure of some functions
Infallible in practice right now, but should be fixed as infallible today does not mean infallible tomorrow:
- sodium_crypto_sign_publickey_from_secretkey
- sodium_crypto_kx_seed_keypair
- sodium_crypto_kx_keypair
- sodium_crypto_auth
- sodium_crypto_sign_ed25519_sk_to_curve25519
- sodium_pad

Fallible today:
- sodium_crypto_sign_ed25519_pk_to_curve25519

Closes GH-14309.
2024-05-23 22:40:28 +02:00
Ilija Tovilo
9506ca6001
Fix enabling of JIT at runtime
Fixes GH-14267
Closes GH-14294
2024-05-22 14:32:43 +02:00
Niels Dossche
b3a56bd558
Fix GH-14290: Member access within null pointer in extension spl
php_pcre_replace_impl() can fail and return NULL. We should take that
error condition into account. Because other failures return false, we
return false here as well.

At first, I also thought there was a potential memory leak in the error
check of replacement_str, but found that the error condition can never
trigger, so replace that with an assertion.

Closes GH-14292.
2024-05-21 23:20:32 +02:00
Pierrick Charron
c69c84a5f6
PHP-8.2 is now for PHP 8.2.21-dev 2024-05-21 14:32:07 -04:00
Derick Rethans
e5cb9d7df9
Force ffp-contract to off 2024-05-20 15:13:53 +01:00
Kamil Tekiela
a59868aef8
Clear mysql error in fetch_into
Closes GH-14256
2024-05-17 13:08:42 +02:00
Marcus Xavier
32d21af296
Fix GH-14100: Corrected spelling mistake in php.ini files.
Closes GH-14138.
2024-05-15 19:46:52 +02:00
Niels Dossche
ebd1a36670
Fix GH-14215: Cannot use FFI::load on CRLF header file with apache2handler
Some modules may reset _fmode, which causes mangling of line endings.
Always be explicit like we do in other places where the native open call
is used.

Closes GH-14218.
2024-05-14 19:49:22 +02:00
Benjamin Cremer
5b6cda6523
Fix GH-14175: Use two digit float specifier for FPM systemd format req rate
Close GH-14175
2024-05-12 13:30:29 +01:00
Niels Dossche
1e2a2d7df2
Fix crash in ParentNode::append() when dealing with a fragment containing text nodes
Credits for test: https://github.com/PhpGt/Dom/pull/454.

Closes GH-14206.
2024-05-12 02:00:31 +02:00
Calvin Buckley
239003e01d Update NEWS for ICU regression fix 2024-05-10 15:33:19 -03:00
Niels Dossche
217b753a3d
Fix GH-14189: PHP Interactive shell input state incorrectly handles quoted heredoc literals.
Only `'` was handled, no handling case for `"` existed. Simply add it so
the heredoc tag is set up correctly.

Closes GH-14195.
2024-05-10 16:48:26 +02:00
Niels Dossche
15813d69a5
Fix GH-14183: XMLReader::open() can't be overridden
We should only return the override if the internal static method is matched.

Closes GH-14194.
2024-05-10 15:57:09 +02:00
Saki Takamachi
12dc51976b
ext/hash: Swap the checking order of __has_builtin and __GNUC__ (#14185)
closes #14185
2024-05-10 09:37:13 +09:00
Ilija Tovilo
42ede5597e
Fix persisting of inherited class constants
Class constants are inherited to user classes without cloning. Thus, internal
class constants should not be persisted at all. Simply keep pointing to the
internal class constant.

Fixes GH-14109
Closes GH-14114
2024-05-06 16:00:48 +02:00
Ilija Tovilo
f8d1864bbb
Delay #[Attribute] arg validation until runtime
Fixes GH-13970
Closes GH-14105

We cannot validate at compile-time for multiple reasons:

* Evaluating the argument naively with zend_get_attribute_value can lead to code
  execution at compile time through the new expression, leading to possible
  reentrance of the compiler.
* Even if the evaluation was possible, it would need to be restricted to the
  current file, because constant values coming from other files can change
  without affecting the current compilation unit. For this reason, validation
  would need to be repeated at runtime anyway.
* Enums cannot be instantiated at compile-time (the actual bug report). This
  could be allowed here, because the value is immediately destroyed. But given
  the other issues, this won't be needed.

Instead, we just move it to runtime entirely. It's only needed for
ReflectionAttribute::newInstance(), which is not particularly a hot path. The
checks are also simple.
2024-05-06 12:38:56 +02:00
Niels Dossche
427c244168
Fix GH-14124: Segmentation fault on unknown address 0x0001ffff8041 with XML extension under certain memory limit (#14126)
The ltags were not initialized, so when an OOM happens before the new value is written, uninitialized data is used.
2024-05-04 14:05:24 +02:00
David Carlier
74843947f4
sapi/cgi: fix buffer limit on windows.
MSDN recommends dropping the deprecated `read` in favor of `_read`.
Also, the buffer size limit is INT_MAX.

Close GH-14022
2024-05-01 13:58:53 +01:00
Niels Dossche
2dbe2d62b3
Fix crash when calling childNodes next() when iterator is exhausted
Closes GH-14091.
2024-04-30 22:30:58 +02:00
Niels Dossche
30a0b0359e
Fix references not handled correctly in C14N
Closes GH-14090.
2024-04-30 22:30:28 +02:00
Niels Dossche
e878b9f390
Fix crashes when entity declaration is removed while still having entity references
libxml doesn't do reference counting inside its node types. It's
possible to remove an entity declaration out of the document, but then
entity references will keep pointing to that stale declaration. This
will cause crashes.

One idea would be to check when a declaration is removed, to trigger a
hook that updates all references. However this means we have to keep
track of all references somehow, which would be a high-overhead
solution. The solution in this patch makes sure that the fields are
always updated before they are read.

Closes GH-14089.
2024-04-30 22:29:44 +02:00
Sergey Panteleev
3b5321dffe
PHP-8.2 is now for PHP 8.2.20-dev 2024-04-23 17:22:54 +03:00
Peter Kokot
44775b7617
Fix GH-13727: Building with -Werror=strict-prototypes (#14029)
This is addon to the GH-13727 bug fix. When configuring the build with:

  ./configure CFLAGS=-Werror=strict-prototypes

libtool check for parsing nm command would fail:

  checking command to parse /usr/bin/nm -B output from cc object... failed

Upstream libtool has this specific check already fixed. Note that this
works only with Autoconf version 2.72 and later and is preparation for
future compilers that might have this error enabled by default.
2024-04-22 21:21:40 +02:00
SATO Kentaro
f8b9030b4e
Temporary reset filename and lineno override before autoload
Closes GH-10232
Closes GH-13313
2024-04-22 10:56:45 +02:00
Peter Kokot
7d3d8de1f3
Fix erroneous dnl appended in configure (#14013)
This is a backport of commit 03f15534a1 to
PHP-8.2 due to GH-14002 and fixes the PHP_CXX_COMPILE_STDCXX check in
ext/intl whether the specified C++ standard is mandatory or optional.

The `dnl` (Discard to Next Line) M4 macro in this combination of `m4_if`
macros and arguments isn't properly replaced and a literal `dnl` string
is appended in the configure script. The `[]dnl` works ok.
2024-04-21 17:23:22 +02:00
David Carlier
42443b4c2e
ext/session: fix _read/_write buffer limit.
MSDN pages mention the buffer size upper limit is INT_MAX not UINT_MAX.
inspired by GH-13205.

Close GH-14017
2024-04-20 17:11:03 +01:00
Saki Takamachi
2a1aa8cac5
Fix GH-13998: Manage refcount of agg_context->val correctly (#14004)
When step_callback fails, agg_context->val is passed dtor, but agg_context->val
is also used in final_callback regardless of the success/failure of step_callback,
so should not call dtor.

closes #14004
fixes #13998
2024-04-20 22:33:25 +09:00
Ilija Tovilo
b3e26c3036
Fix missing handling of CALLABLE_CONVERT in cleanup_unfinished_calls()
Fixes GH-14003
2024-04-19 20:04:51 +02:00
David Carlier
cc46a4e6b5
ext/intl: level up c++ runtime std for icu 74 and onwards.
to align with what is required to build icu 74 itself.

Close GH-14002
2024-04-19 10:04:25 +01:00
Saki Takamachi
fda91a0543
Fix GH-13984: Buffer size is now checked before memcmp (#13991)
Fixed an issue where a buffer overflow occurred when a string shorter than
`:memory:` was passed as the db name of pdo_sqlite.

fixed #13984
closes #13991
2024-04-18 08:35:50 +09:00