Commit Graph

134078 Commits

Author SHA1 Message Date
Niels Dossche
6a23c7fa91
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13836: Renaming a file in a Phar to an already existing filename causes a NULL pointer dereference
2024-03-30 18:04:29 +01:00
Niels Dossche
ed8ed714a8
Fix GH-13836: Renaming a file in a Phar to an already existing filename causes a NULL pointer dereference
If the destination already exists, then the `add` function on the
manifest will return NULL, resulting in a NULL entry and therefore a
NULL deref. As `copy()` (not `Phar::copy`) chooses to succeed and
overwrite the destination if it already exists, we should do the same.
Therefore the fix is as simple as changing `add` to `update`.

Closes GH-13840.
2024-03-30 18:03:55 +01:00
Jakub Zelenka
1b585d2620
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-30 14:38:19 +00:00
Jakub Zelenka
9b1d2e93b8
Fix FPM tester default env vars change
This broke cloexec test
2024-03-30 14:37:54 +00:00
Jakub Zelenka
9cf0f30193
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-29 19:39:15 +00:00
Jakub Zelenka
11caf094f1
Fix GH-13620: Failing openssl_private_decrypt tests
Use OPENSSL_PKCS1_OAEP_PADDING padding in tests

Closes GH-13667
2024-03-29 19:33:37 +00:00
Niels Dossche
508ed9b474 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13827: Null pointer access of type 'zval' in phpdbg_frame
2024-03-29 17:55:33 +01:00
Niels Dossche
d3f1f3ab40 Fix GH-13827: Null pointer access of type 'zval' in phpdbg_frame
We don't always have the line and filename in a backtrace frame, but
phpdbg assumes we do.

Closes GH-13831.
2024-03-29 17:54:23 +01:00
Jakub Zelenka
5231e71bfd
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-29 16:33:26 +00:00
Jakub Zelenka
100258ffd6
Fix test for GH-10495: feof on OpenSSL stream hangs 2024-03-29 16:32:23 +00:00
Jakub Zelenka
f4a9ae90f9
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-29 16:25:09 +00:00
Jakub Zelenka
c1bd9a932a
Fix GH-10495: feof on OpenSSL stream hangs indefinitely
This fixes the issue with unbounded waiting on SSL_peek which can happen
when only part of the record is fetched. It makes socket non blocking so
it is possible to verify if OpenSSL is expecting some more data or if
there is an error.

This also fixes bug #79501

Closes GH-13487
2024-03-29 16:22:22 +00:00
Jakub Zelenka
caec2b6186
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-29 16:09:09 +00:00
Jakub Zelenka
c087398cc2
Fix GH-13264: Part 1 - Memory leak on filter failure
Closes GH-13790
2024-03-29 16:06:49 +00:00
Jakub Zelenka
cd6a58114e Fix NEWS for the last FPM change 2024-03-29 16:05:13 +00:00
Jakub Zelenka
8edd621501
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-28 15:45:45 +00:00
Jakub Zelenka
d0a8d41eee
Fix GH-13563: Setting bool values via env in FPM config fails
Closes GH-13786
2024-03-28 15:43:50 +00:00
Niels Dossche
55e617691a Fix GH-13433: Segmentation Fault in zend_class_init_statics when using opcache.preload
This regressed in 9a250cc9d6, which allowed static properties to get
overridden by a trait during inheritance. In particular, because of the
change to the loop in zend_update_parent_ce(), it's not guaranteed that
all indirects are after one another.

This means that during persisting the zvals of the static members table,
some static properties may be skipped. In case of the test code, this
means that the array in the trait will keep referring to the old, new
freed, stale value. To solve this, we check the type for IS_INDIRECT,
which is the same as what zend_persist_calc() is already doing anyway.

Since 2543e61aed we can check for IS_INDIRECT to see if it should be
persisted or not.

Closes GH-13794.
2024-03-26 21:29:07 +01:00
Eric Mann
9381129d1b
PHP-8.3 is now for PHP 8.3.6-dev 2024-03-26 09:08:14 -07:00
Pierrick Charron
6b40a5af09
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  PHP-8.2 is now for PHP 8.2.19-dev
2024-03-26 08:50:36 -04:00
Pierrick Charron
7942268899
PHP-8.2 is now for PHP 8.2.19-dev 2024-03-26 08:49:44 -04:00
Arnaud Le Blanc
667586bb61 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Tests are not repeatable
2024-03-26 12:35:20 +01:00
Arnaud Le Blanc
bb6b659aa8 Tests are not repeatable
gc_threshold is inherited accross requests, so the tests fail when repeating
2024-03-26 12:33:44 +01:00
Arnaud Le Blanc
ff2359b62e [ci skip] 2024-03-25 16:23:44 +01:00
Arnaud Le Blanc
9a51a7fb30 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip]
  Adjust GC threshold if num_roots is higher than gc_threshold after collection (#13758)
2024-03-25 16:22:54 +01:00
Arnaud Le Blanc
f968a63162 [ci skip] 2024-03-25 16:19:32 +01:00
Arnaud Le Blanc
c13794cdcb
Adjust GC threshold if num_roots is higher than gc_threshold after collection (#13758)
This fixes an edge case causing the GC to be triggered repeatedly.

Destructors might add potential garbage to the buffer, so it may happen that num_root it higher than gc_threshold after collection, thus triggering a GC run almost immediately. This can happen by touching enough objects in a destructor, e.g. by iterating over an array. If this happens again in the new run, and the threshold is not updated, the GC may be triggered again.

The edge case requires specific conditions to be triggered and it must happen rarely in practice:

 * At least GC_THRESHOLD_TRIGGER (100) objects must be collected during each run for the threshold to not be updated
 * At least GC_G(gc_threshold) (initially 10k) objects must be touched (decref'ed to n>0) by any destructor during each run to fill the buffer

The fix is to increase the threshold if GC_G(num_roots) >= GC_G(gc_threshold) after GC. The threshold eventually reaches a point at which the second condition is not met anymore.

The included tests trigger more than 200 GC runs before the fix, and 2 after the fix (dtors always trigger a second run).

A related issue is that zend_gc_check_root_tmpvars() may add potential garbage before the threshold is adjusted, which may trigger GC and exhaust the stack. This is fixed by setting GC_G(active)=1 around zend_gc_check_root_tmpvars().
2024-03-25 16:17:54 +01:00
Niels Dossche
81ae6064ce Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix incorrect check in fpm_shm_free() (#13797)
2024-03-24 13:58:41 +01:00
Niels Dossche
e3fbfddbd2 [ci skip] NEWS 2024-03-24 13:58:09 +01:00
Niels Dossche
dd3aa18545
Fix incorrect check in fpm_shm_free() (#13797)
`if (fpm_shm_size - size > 0)` will be rewritten by the compiler as this: `if (fpm_shm_size != size)`, which is undesirable. The reason this happens is that both variables are size_t, so subtracting them cannot be negative. The only way it can be not > 0, is if they're equal because the result will then be 0. This means that the else branch won't work properly. E.g. if `fpm_shm_size == 50` and `size == 51`, then `fpm_shm_size` will wraparound instead of becoming zero.

To showcase that the compiler actually does this, take a look at this
isolated case: https://godbolt.org/z/azobdWcrY. Here we can see the
usage of the compare instruction + cmove, so the "then" branch
is only done if the variables are equal.
2024-03-24 13:57:08 +01:00
Remi Collet
c007dca32d
[ci skip] NEWS 2024-03-22 11:39:46 +01:00
Remi Collet
180369216d
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
2024-03-22 11:39:28 +01:00
Remi Collet
6f11cc46e0
[ci skip] NEWS 2024-03-22 11:39:17 +01:00
Niels Dossche
67ce1d859d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix incorrect charset length in check_mb_eucjpms()
2024-03-22 11:32:15 +01:00
Niels Dossche
8ffac997aa Fix incorrect charset length in check_mb_eucjpms()
Closes GH-13781.
2024-03-22 11:31:36 +01:00
Remi Collet
2b7917391c
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix AX_GCC_FUNC_ATTRIBUTE failure
2024-03-22 11:30:07 +01:00
Remi Collet
09a36812c1
Fix AX_GCC_FUNC_ATTRIBUTE failure 2024-03-22 11:29:45 +01:00
Niels Dossche
05989e9e2c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix phpdoc for DOMDocument load methods
2024-03-20 17:23:26 +01:00
Vincent Langlet
741570c30f Fix phpdoc for DOMDocument load methods
Closes GH-13763.
2024-03-20 17:22:04 +01:00
Ilija Tovilo
3301d9602a
Restore error handler after running it
Symfony relies on finding the exception handler in the handler stack. There's
currently no clean API to find it, so they pop all the handlers, and push them
again once the stack is empty. This PR attempts to minimize the BC break by
pushing the current handler onto the stack and clearing the current handler, and
restoring it once it has finished. This is essentially equivalent to
set_exception_handler(null) and restore_exception_handler().

restore_exception_handler() however is only called if the exception handler is
still unset. If the handler has pushed a new handler in the meantime, we assume
it knows what it's doing.

Fixes GH-13446
Closes GH-13686
2024-03-20 10:53:20 +01:00
David Carlier
f2ec6e4806 Merge branch 'PHP-8.2' into PHP-8.3 2024-03-19 22:35:18 +00:00
David Carlier
db063cb771 CI: update freebsd 13 image.
13.2 is going to be EOL.

close GH-13622
2024-03-19 22:34:56 +00:00
Ilija Tovilo
697d1a1c63
Fix ASan build
See https://github.com/actions/runner-images/issues/9491#issuecomment-1989718917

The mentioned workaround doesn't work for us because we run ASan inside Docker.
Instead, we switch to ubuntu-20.04 as the host. The docker setup itself remains
the same.

Closes GH-13757
2024-03-19 17:15:36 +01:00
Bob Weinand
50fe64c345 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 20:26:00 +01:00
Bob Weinand
059bf33e60
Properly forward the signal to the original handler if TSRM is shutdown. (#10219)
This ensures proper handling of SIGQUIT in ZTS fpm builds outside of active requests.
2024-03-18 20:24:23 +01:00
Bob Weinand
6d6cd29909 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 19:04:12 +01:00
Bob Weinand
10d912d6e3
Fix GH-13712: Segmentation fault for enabled observers when calling trait method of internal trait when opcache is loaded (#13735)
Inherited methods regardless of source must share the original runtime cache. Traits were missed.
This adds ZEND_ACC_TRAIT_CLONE to internal functions as well to allow easy distinction of these.
2024-03-18 19:02:42 +01:00
Bob Weinand
35aef8ee87 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 17:22:23 +01:00
Bob Weinand
6fb8b9d721 Fix possible segfault with 0x0 shared opcache base
Moving the minimum base of the shared opcache memory to the second huge page to avoid a possible 0x0 base, which may cause all sorts of segfaults.
This is not a problem on most systems which have a mmap_min_addr which is non-zero, but e.g. WSL1 doesn't have a minimum mapping address.
2024-03-18 17:18:33 +01:00
Peter Kokot
f66696548b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests
2024-03-18 11:58:56 +01:00