Commit graph

135533 commits

Author SHA1 Message Date
qiangxuhui
0766ac6e35
loongarch64 support for fibers
Add loongarch64 assembly files from Boost, needed for fibers support,
and hook up loongarch64 fibers support during configure.

Close GH-13914
2024-04-08 18:59:02 +01:00
Niels Dossche
ae5220aed6
Avoid call to php_socket_errno() if possible (#13909)
This call is only necessary if ret < 0.
Note that I also had to reoder the checks for EWOULDBLOCK, EMSGSIZE, EAGAIN
to avoid a false positive GCC warning about a duplicate condition
(EAGAIN == EWOULDBLOCK on my system).
2024-04-08 19:53:01 +02:00
Niels Dossche
9b5749a97e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix potential NULL pointer dereference before calling EVP_SignInit
2024-04-08 19:31:20 +02:00
Niels Dossche
07fe3b2920
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix potential NULL pointer dereference before calling EVP_SignInit
2024-04-08 19:31:13 +02:00
icy17
6f8bda0582
Fix potential NULL pointer dereference before calling EVP_SignInit
Closes GH-13870.
2024-04-08 19:30:26 +02:00
Bob Weinand
13c8d9317f Merge branch 'PHP-8.3' 2024-04-08 15:25:00 +02:00
Bob Weinand
f52b2a9cdc Merge branch 'PHP-8.2' into PHP-8.3 2024-04-08 15:10:29 +02:00
Bob Weinand
af098acd6e Always load EX(opline) into the current frame in JIT when observers are enabled
Fixes #13772.
Closes #13776.
2024-04-08 15:09:14 +02:00
Arnaud Le Blanc
345580c5e8 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix cookie_seek_function_t signature under musl (#13890)
2024-04-08 15:03:37 +02:00
Arnaud Le Blanc
0da1eb5fb9 [ci skip] NEWS 2024-04-08 15:03:21 +02:00
Arnaud Le Blanc
618eb3d468 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix cookie_seek_function_t signature under musl (#13890)
2024-04-08 15:02:32 +02:00
Arnaud Le Blanc
85d621242a [ci skip] NEWS 2024-04-08 15:01:15 +02:00
Arnaud Le Blanc
577b8ae422
Fix cookie_seek_function_t signature under musl (#13890)
Fixes GH-11678
2024-04-08 14:58:12 +02:00
David CARLIER
7c860628cd
ext/pcntl: getpriority/setpriority who default value handling change. (#13911)
0 refers to the calling process, all across unixes, thus saving one
syscall.
2024-04-07 22:30:48 +01:00
Niels Dossche
68592c84a1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Improve stability of test gh13860.phpt
2024-04-07 22:50:28 +02:00
Niels Dossche
73218e063a
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Improve stability of test gh13860.phpt
2024-04-07 22:50:09 +02:00
Niels Dossche
a86256c950
Improve stability of test gh13860.phpt 2024-04-07 22:49:58 +02:00
tekimen
0f1e97957a
Fix GH-13789: build failed mbstring_arginfo.h when Visual C++ on Windows (#13906)
Probably CP932 environment can't compile. So add /utf-8 flag.
2024-04-07 21:43:46 +02:00
Niels Dossche
1e4bb039eb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13860: Incorrect PHP_STREAM_OPTION_CHECK_LIVENESS case in ext/openssl/xp_ssl.c - causing use of dead socket
2024-04-07 21:37:09 +02:00
Niels Dossche
92136640aa
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13860: Incorrect PHP_STREAM_OPTION_CHECK_LIVENESS case in ext/openssl/xp_ssl.c - causing use of dead socket
2024-04-07 21:37:01 +02:00
Niels Dossche
2aae14c8a9
Fix GH-13860: Incorrect PHP_STREAM_OPTION_CHECK_LIVENESS case in ext/openssl/xp_ssl.c - causing use of dead socket
php_socket_errno() may return a stale value when recv returns a
value >= 0. As such, the liveness check is wrong.
This is the same bug as #70198 (fixed in GH-1456). So we fix it in the
same way.

Closes GH-13895.
2024-04-07 21:35:43 +02:00
David Carlier
d8f2900574
ext/pcntl: adding pcntl_getcpu.
using sched_getcpu under the hood (Linux and FreeBSD).
Returns the current cpu id for the current process.
For Linux, we need to see beyond the sole presence of the symbol
to consider it.
Mostly useful, for now, in the cpu affinity context since
the os can migrate processes as it sees fits otherwise.

Clos GH-13908
2024-04-07 20:05:03 +01:00
David CARLIER
dd2ffaab2c
ext/pcntl: pcntl affinity improves EINVAL handling in both cases. (#13907)
also disable tests on travis.
2024-04-07 16:43:36 +01:00
Niels Dossche
814098248c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix persistent local flag in session url updating (#13905)
2024-04-07 15:25:15 +02:00
Niels Dossche
6c7707e918
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix persistent local flag in session url updating (#13905)
2024-04-07 15:25:08 +02:00
Niels Dossche
4a14211739
Fix persistent local flag in session url updating (#13905)
Short-lived regression from 5ce9687cb2.
I forgot to add the persistent local flag, so that means that RC_DEBUG
will complain. These strings are local to the thread so we can just add
the flag to silence the debug checker in this case.
2024-04-07 15:24:29 +02:00
David Carlier
01817e99ab
ext/pcntl pcntl_signal_get_handler update.
The situation varies from platform to another, thus taking in
account the complexity of it.

Close GH-13902
2024-04-07 13:25:45 +01:00
Bob Weinand
a22a87243f
Add next handler parameter to zend_observer_remove_begin/end_handler (#13807)
The usage of the current API within an observer handler leads to bugs like https://bugs.xdebug.org/view.php?id=2232.
Given two observer handlers, next to each other. The first one is executed. It removes itself. The second observer handler gets moved to the place of the first. The first one returns. The handler in the second slot is fetched, but is now NULL, because the it's now in the slot of the first observer; i.e. the second handler is skipped and the begin/end symmetry guarantee is violated.

Providing the next handler to the caller is a zero-cost way to avoid any impact in the paths of zend_observe_fcall_begin/end.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2024-04-07 14:06:25 +02:00
Niels Dossche
a0da32a42d
Cleanup and optimize attribute value reading (#13897)
When the attribute has a single text child, we can avoid an allocating
call to libxml2 and read the contents directly.

On my i7-4790, I tested the optimization with both the $value and
$nodeValue property.

```
Summary
  ./sapi/cli/php bench_value.php ran
    1.82 ± 0.09 times faster than ./sapi/cli/php_old bench_value.php

Summary
  ./sapi/cli/php bench_nodeValue.php ran
    1.78 ± 0.10 times faster than ./sapi/cli/php_old bench_nodeValue.php
```

Test code:
```
$dom = new DOMDocument;
$dom->loadXML('<root attrib="this is a relatively short text"/>');
$attrib = $dom->documentElement->attributes[0];

for ($i=0; $i<1000*1000; $i++) {
	$attrib->value; // or nodeValue
}
```
2024-04-07 13:08:31 +02:00
David CARLIER
0086815773
adding myself to ext/pcntl ext. (#13901) 2024-04-07 09:35:36 +01:00
Máté Kocsis
365e211884
Convert odbc_bindcols() function to void (#13900) 2024-04-07 08:44:37 +02:00
David Carlier
1cf8291c85
ext/pcntl: cpu affinity api introduction.
For now, working on Linux, FreeBSD >= 13.x and DragonFlyBSD.
Handy wrapper to assign an array of cpu ids or to retrieve the cpu ids
assigned to a given process.

pcntl_setaffinity inserts valid unique cpu ids (within the range of available
cpus).

Close GH-13893
2024-04-07 00:56:54 +01:00
Juan Morales
c96b975f67
filter_input_array - Implement solution 2 of GH-13805 (#13804) 2024-04-07 00:18:12 +02:00
Máté Kocsis
9a4847acf5
Get rid of non-exposed solid_fetch_prev() function
Somehow it wasn't exposed to userland.
2024-04-06 22:56:23 +02:00
Máté Kocsis
b981d4aff9
Declare true return type for ext/odbc functions 2024-04-06 22:56:23 +02:00
Tim Düsterhus
7c851042cb
random: Add clarifying comments to the implementation of CombinedLCG
The implementation is needlessly obfuscated. It's not immediately clear that
MODMULT is a simple modular multiplication, despite its name. Specifically it's
not clear which of the parameters is the second factor.

Furthermore the stated period is off-by-one: A value of `0` is part of its own
chain, thus it may not be included in the period of the underlying generators.
2024-04-06 17:46:28 +02:00
Niels Dossche
cf313321c2
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix GH-13891: memleak and segfault when using ini_set with session.trans_sid_hosts (#13892)
2024-04-06 13:45:10 +02:00
Niels Dossche
eb244fcb49
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix GH-13891: memleak and segfault when using ini_set with session.trans_sid_hosts (#13892)
2024-04-06 13:45:00 +02:00
Niels Dossche
8367e9cc3b
[ci skip] NEWS 2024-04-06 13:44:34 +02:00
Niels Dossche
5ce9687cb2
Fix GH-13891: memleak and segfault when using ini_set with session.trans_sid_hosts (#13892)
The hash tables used are allocated via the persistent allocator.
When using ini_set, the allocation happens via the non-persistent
allocator. When the table is then freed in GSHUTDOWN, we get a crash
because the allocators are mismatched.

As a side note, it is strange that this is designed this way, because it
means that ini_sets persist between requests...

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2024-04-06 13:43:26 +02:00
Niels Dossche
0a0e8064e0
Fix serialization of entity references in attributes (#13884) 2024-04-05 19:58:01 +02:00
Ilija Tovilo
536305436f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix opcache dump varying tmps
2024-04-05 14:12:23 +02:00
Ilija Tovilo
017cf41647
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix opcache dump varying tmps
2024-04-05 14:12:08 +02:00
Ilija Tovilo
97162e92be
Fix opcache dump varying tmps 2024-04-05 14:11:41 +02:00
David CARLIER
2508138532
ext/pcntl: pcnt_setns few nitpicks changes. (#13885) 2024-04-04 21:05:35 +01:00
David Carlier
ae4978a139
ext/pcntl: adding pcntl_setns for Linux >= 5.3
allows a given process to join an existing Linux namespace, relatively
complementary to the existing pcntl_unshare.

Close GH-13878
2024-04-04 18:45:15 +01:00
Niels Dossche
e08a5dce8f
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix shift out of bounds on 32-bit non-fast-path platforms (#10941)
2024-04-04 19:29:36 +02:00
Niels Dossche
5daf080b6b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix shift out of bounds on 32-bit non-fast-path platforms (#10941)
2024-04-04 19:29:29 +02:00
Niels Dossche
dfbad9f227
[ci skip] NEWS 2024-04-04 19:29:04 +02:00
Niels Dossche
8bfde5d01e
Fix shift out of bounds on 32-bit non-fast-path platforms (#10941)
The x86-32 build uses a fast path, but when I disabled the fast path I
got the following compile error with -Werror:
mysqlnd_portability.h:221:95: error: right shift count >= width of type [-Werror=shift-count-overflow]

For 32-bit platforms that don't have the fast path, this can cause
undefined behaviour at runtime. Some CPUs just mask the shift amount
so in those cases you even get wrong results.
This is not always found during the build because -Werror is off by
default.
2024-04-04 19:28:10 +02:00