Commit graph

67921 commits

Author SHA1 Message Date
Gina Peter Banyard
c74f1bebc6 ext/phar: Prevent duplicate strlen() computation in phar_wrapper_open_dir() 2024-09-26 21:36:03 +01:00
Gina Peter Banyard
a600713cd6 ext/phar: Use HASH_FOREACH macro in phar_wrapper_open_dir()
Also simplify the inner if condition
2024-09-26 21:36:03 +01:00
Gina Peter Banyard
615960be9c ext/phar: Refer to zend_string* length directly
This makes it more obvious that the host_len is that of resource->host
2024-09-26 21:36:03 +01:00
Gina Peter Banyard
839952c65a ext/phar: Use HASH_FOREACH macro in phar_wrapper_rmdir()
Also simplify the inner if condition
2024-09-26 21:36:03 +01:00
Ilija Tovilo
d21bc7f1e6
Disallow enums in ArrayObject
Closes GH-15775
2024-09-26 22:21:09 +02:00
Dmitry Stogov
c34b37fe0b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix FFI prototypes (these functions can't return NULL) (#16075)
2024-09-26 20:20:11 +03:00
Dmitry Stogov
a37a3d3d81
Fix FFI prototypes (these functions can't return NULL) (#16075) 2024-09-26 20:19:46 +03:00
Ilija Tovilo
5e83586896
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Mark one more curl test as xleak
2024-09-26 16:50:12 +02:00
Ilija Tovilo
c7bc91cfcd
[skip ci] Mark one more curl test as xleak 2024-09-26 16:50:06 +02:00
Ilija Tovilo
26ccfbe111
Merge branch 'PHP-8.4'
* PHP-8.4:
  Switch asan build to Ubuntu 24.04
2024-09-26 15:16:30 +02:00
Ilija Tovilo
b14d440a82
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Switch asan build to Ubuntu 24.04
2024-09-26 15:15:39 +02:00
Ilija Tovilo
91c06790de
Switch asan build to Ubuntu 24.04
Closes GH-16065
2024-09-26 15:13:35 +02:00
Dmitry Stogov
81438e3fe8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix possible NULL dereference
2024-09-26 15:44:25 +03:00
Dmitry Stogov
b8ac4ca19d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix possible NULL dereference
2024-09-26 15:44:16 +03:00
Dmitry Stogov
8b7f64fa41
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix possible NULL dereference
2024-09-26 15:44:05 +03:00
Dmitry Stogov
24d5912a30
Fix possible NULL dereference 2024-09-26 15:43:42 +03:00
Christoph M. Becker
9e3b959bf9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix bug71610.phpt
2024-09-26 13:19:21 +02:00
Christoph M. Becker
d6b8ef81d7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug71610.phpt
2024-09-26 13:18:52 +02:00
Christoph M. Becker
70eb8f06ed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug71610.phpt
2024-09-26 13:16:36 +02:00
Christoph M. Becker
de51612ba5
Fix bug71610.phpt
Apparently example.org now rejects POST requests, so we would need to
adjust the test expectation ("Method not allowed").  However, there is
no need for an online test; instead we're just using the CLI test
server.  The serialization is a bit fiddly, but as long as there are
no quotes in `PHP_CLI_SERVER_ADDRESS` we're fine.

Closes GH-16063.
2024-09-26 13:16:00 +02:00
Peter Kokot
9ee9c0e674
Sync exif dependency on mbstring extension as optional (#16062)
When decoding multibyte data in EXIF tags, the mbstring extension needs
to be enabled. In Autotools this is now synced with ZEND_MOD_OPTIONAL
in the C code, and on Windows it is now also optional.

The required dependency on mbstring extension was removed via
755c2cd0d8 which made the mbstring
extension optional dependency.
2024-09-26 09:53:58 +02:00
Remi Collet
d62b9eb9c4
Merge branch 'PHP-8.4'
* PHP-8.4:
  zip extension is 1.22.4
2024-09-26 09:39:29 +02:00
Remi Collet
a1cacec067
zip extension is 1.22.4 2024-09-26 09:39:10 +02:00
Gina Peter Banyard
255f59e53c
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/ldap: Fix GH-16032 (Various NULL pointer dereferencements in ldap_modify_batch())
2024-09-25 23:27:27 +01:00
Gina Peter Banyard
18f61ad47d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/ldap: Fix GH-16032 (Various NULL pointer dereferencements in ldap_modify_batch())
2024-09-25 23:27:12 +01:00
Gina Peter Banyard
459486a7db
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/ldap: Fix GH-16032 (Various NULL pointer dereferencements in ldap_modify_batch())
2024-09-25 23:26:31 +01:00
Gina Peter Banyard
f4c45ee376
ext/ldap: Fix GH-16032 (Various NULL pointer dereferencements in ldap_modify_batch())
We check that the "attrib" and "modtype" keys are present in each array.
If not we throw a ValueError, in line with what other validation failure cases do.

Closes GH-16057
2024-09-25 23:23:56 +01:00
Niels Dossche
e035a95723
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16054: Segmentation fault when resizing hash table iterator list while adding
2024-09-25 21:09:11 +02:00
Niels Dossche
4b8a12d1e6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16054: Segmentation fault when resizing hash table iterator list while adding
2024-09-25 21:08:36 +02:00
Niels Dossche
fdd6ba62bb
Fix GH-16054: Segmentation fault when resizing hash table iterator list while adding
zend_array_dup_ht_iterators() loops over the hash table iterators and
can call zend_hash_iterator_add(). zend_hash_iterator_add() can resize
the array causing a crash in zend_array_dup_ht_iterators().

We solve this by refetching the iter pointer after an add happened.

Closes GH-16060.
2024-09-25 21:05:05 +02:00
Niels Dossche
0d1d905353
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16039: Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c
2024-09-25 19:39:58 +02:00
Niels Dossche
97546746d0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16039: Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c
2024-09-25 19:39:49 +02:00
Niels Dossche
68d494d690
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16039: Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c
2024-09-25 19:33:29 +02:00
Niels Dossche
043b9e1f13
Fix GH-16039: Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c
dom_object_get_node() can fail if we don't have a user object
associated.

Closes GH-16056.
2024-09-25 19:31:19 +02:00
Tim Düsterhus
3c8c0df6c8
pdo: Use zend_string_toupper in pdo_stmt_describe_columns (#16047)
zend_string_toupper was only introduced in PHP 8.2 and thus it likely was not
used here, since this code was last touched for PHP 8.0.
2024-09-25 14:52:02 +02:00
Niels Dossche
daba40c695
Fix GH-16009: Segmentation fault with frameless functions and undefined CVs
The frameless function handlers do not update the op variables when
handling the result is undefined. In this case this causes propagating
an UNDEF value into a temporary, which results in an extra undefined
variable warning for a temporary in this case.

The original issue also reports a crash in some cases, which is also
fixed by this patch.

Closes GH-16012.
2024-09-24 21:20:35 +02:00
Calvin Buckley
f5f05e886e
Fix regression on systems built without JIT (#16024)
regressing commit: 654b787ee1

This was called if JIT was enabled or not. If not enabled, it'll result
in an undeclared function warning and maybe a bad time in the linker.
Gate the meat of this PHP-side function on if JIT is enabled (but keep
it existing so PHP userland code works with or without JIT, OFC).
2024-09-24 11:38:59 -03:00
Florian Engelhardt
3293fafa27
Add OPcache restart hook (#15590)
This hook will allow observing extensions to observe the actual OPcache restart.
2024-09-24 16:24:01 +02:00
Saki Takamachi
c5b258fedc
Fix GH-15968: Avoid converting objects to strings in operator calculations. (#16021) 2024-09-24 22:33:36 +09:00
Bob Weinand
654b787ee1
Add API to exempt function from being traced in JIT (#15559)
Internally accessible via zend_jit_blacklist_function / externally via opcache_jit_blacklist.
The functionality currently only affects tracing JIT, but may be extended to other JIT modes in future.
2024-09-24 14:20:38 +02:00
Christoph M. Becker
f89eb15f72
Port libgd/libgd/pull/711 (GH-16016)
Note that this is not actually security related[1], but still a
reasonable sanity check.

"If a function be advertised to return an error code in the event of
difficulties, thou shalt check for that code, yea, even though the
checks triple the size of thy code and produce aches in thy typing
fingers, for if thou thinkest it cannot happen to me, the gods shall
surely punish thee for thy arrogance." – Henry Spencer

[1] <https://github.com/libgd/libgd/issues/697#issuecomment-2369613187>
2024-09-24 13:58:31 +02:00
Ayesh Karunaratne
99bceda0b3
ext/curl: Add CURLINFO_POSTTRANSFER_TIME_T support (GH-15849)
libcurl ref: [`CURLINFO_POSTTRANSFER_TIME_T`](https://curl.se/libcurl/c/CURLINFO_POSTTRANSFER_TIME_T.html)

`CURLINFO_POSTTRANSFER_TIME_T` is a libcurl info option that returns
the time it took to "post" the transfer. Available since libcurl 8.10.0

This value is also exposed as `posttransfer_time_us` in the
`curl_getinfo()` return value when the `$option` parameter is not
passed.
2024-09-24 13:39:07 +02:00
David Carlier
f35ad560b4
GH-12940 ext/pdo_pgsql: using PQclosePrepared to free statement resources.
PQclosePrepared allows the statement's name to be reused thus allowing
cache solutions to work properly ; whereas, for now, the `DEALLOCATE
<statement>` query is used which free entirely the statement's resources.

close GH-13316
2024-09-24 12:09:56 +01:00
Christoph M. Becker
f44250c418
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15980: Signed integer overflow in main/streams/streams.c
2024-09-24 12:35:06 +02:00
Christoph M. Becker
acee803e6a
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15980: Signed integer overflow in main/streams/streams.c
2024-09-24 12:33:17 +02:00
Christoph M. Becker
81916758ec
Fix GH-15980: Signed integer overflow in main/streams/streams.c
We need to avoid signed integer overflows which are undefined behavior.
We catch that, and set `offset` to `ZEND_LONG_MAX` (which is also the
largest value of `zend_off_t` on all platforms).  Of course, that seek
may fail, but even if it succeeds, the stream is no longer readable,
but that matches the current behavior for offsets near `ZEND_LONG_MAX`.

Closes GH-15989.
2024-09-24 12:32:00 +02:00
Ayesh Karunaratne
ba748e7bb5
ext/curl: Add CURLOPT_DEBUGFUNCTION option (GH-15674)
This adds support for `CURLOPT_DEBUGFUNCTION`[^1] Curl option to set a
custom callback that gets called with debug information during the
lifetime of a Curl request.

The callback gets called with the `CurlHandle` object, an integer
containing the type of the debug message, and a string containing the
debug message. The callback may get called multiple times with the
same message type during a request.

PHP already uses `CURLOPT_DEBUGFUNCTION` functionality to internally
to expose a Curl option named `CURLINFO_HEADER_OUT`.

However,`CURLINFO_HEADER_OUT` is not a "real" Curl option supported
by libcurl. Back in 2006, `CURLINFO_HEADER_OUT` was added[^2] as
a Curl option by using the debug-callback feature. Git history does
not run that back to show why `CURLINFO_HEADER_OUT` was added as a
Curl option, and why the other debug types (such as
`CURLINFO_HEADER_IN` were not added as Curl options, but this seems
to be a historical artifact when we added features without trying
to be close to libcurl options.

This approach has a few issues:

1. `CURLINFO_HEADER_OUT` is not an actual Curl option supported by
  upstream libcurl.

2. All of the Curl options have `CURLOPT_` prefix, and `CURLINFO_HEADER_OUT`
  is the only Curl "option" that uses the `CURLINFO` prefix. This exception
  is, however, noted[^3] in docs.

3. When `CURLINFO_HEADER_OUT` is set, the `CURLOPT_VERBOSE` is also implicitly
  set. This was reported[^4] to bugs.php.net, but the bug is marked as wontfix.

This commit adds support for `CURLOPT_DEBUGFUNCTION`. It extends the existing
`curl_debug` callback to store the header-in information if it encounters
a debug message with `CURLINFO_HEADER_OUT`. In all cases, if a callable
is set, it gets called.

`CURLOPT_DEBUGFUNCTION` intends to replace `CURLINFO_HEADER_OUT` Curl
option as a versatile alternative that can also be used to extract
other debug information such as SSL data, text information messages,
incoming headers, as well as headers sent out (which `CURLINFO_HEADER_OUT`
makes available).

The callables are allowed to throw exceptions, but the return values are
ignored.

`CURLOPT_DEBUGFUNCTION` requires `CURLOPT_VERBOSE` enabled, and setting
`CURLOPT_DEBUGFUNCTION` does _not_ implicitly enable `CURLOPT_VERBOSE`.

If the `CURLOPT_DEBUGFUNCTION` option is set, setting `CURLINFO_HEADER_OUT`
throws a `ValueError` exception. Setting `CURLOPT_DEBUGFUNCTION` _after_
enabling `CURLINFO_HEADER_OUT` is allowed. Technically, it is possible
for both functionality (calling user-provided callback _and_ storing
header-out data) is possible, setting `CURLINFO_HEADER_OUT` is not
allowed to encourage the use of `CURLOPT_DEBUGFUNCTION` function.

This commit also adds the rest of the `CURLINFO_` constants used as
the `type` integer value in `CURLOPT_DEBUGFUNCTION` callback.

---

[^1]: [cur.se - CURLOPT_DEBUGFUNCTION](https://curl.se/libcurl/c/CURLOPT_DEBUGFUNCTION.html)
[^2]: [`5f25d80`](5f25d80d10)
[^3]: [curl_setopt doc mentioning `CURLINFO_` prefix is intentional](https://www.php.net/manual/en/function.curl-setopt.php#:~:text=prefix%20is%20intentional)
[^4]: [bugs.php.net - `CURLOPT_VERBOSE` does not work with `CURLINFO_HEADER_OUT`](https://bugs.php.net/bug.php?id=65348)
2024-09-24 10:56:56 +02:00
Dmitry Stogov
8f00430a2b
Fix GH-15972: Assertion failure in ext/opcache/jit/zend_jit_vm_helpers.c with function JIT (#16001) 2024-09-24 10:24:08 +03:00
Calvin Buckley
07377de110 Merge branch 'PHP-8.3'
* PHP-8.3:
  Cast big endian byte shuffling to uint
2024-09-24 02:24:02 -03:00
Calvin Buckley
22d25d2896 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Cast big endian byte shuffling to uint
2024-09-24 02:23:51 -03:00