1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Commit Graph

135511 Commits

Author SHA1 Message Date
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
Tim Düsterhus
98b43d07f9 Merge branch 'PHP-8.3'
* PHP-8.3:
  makedist: Reset tar timestamps to the commit date (#13879)
2024-04-04 13:26:47 +02:00
Tim Düsterhus
1fb38361ae Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  makedist: Reset tar timestamps to the commit date (#13879)
2024-04-04 13:26:36 +02:00
Tim Düsterhus
c89d797a41 makedist: Reset tar timestamps to the commit date (#13879)
This change should make the underlying `.tar` archive fully reproducible (given
identical tool versions).
2024-04-04 13:26:27 +02:00
Dmitry Stogov
0bf574afa3 Update IR
IR commit: 709ccf854ec708c36c0dd2a77996554f13e722f3

Fixes failures in function JIT introduced in d2b54dc
2024-04-04 10:09:51 +03:00
Dmitry Stogov
d2b54dc53e Update IR
IR commit: eee484977acfe97b81b338a16390e218a852ec1c
2024-04-04 01:11:28 +03:00
Niels Dossche
bb1688d732 Fix argument signedness of dom_sanity_check_node_list_types() (#13875) 2024-04-03 18:18:24 +02:00
Niels Dossche
5ca72eca8e Remove broken check in var_unserializer (#13852)
`end = *p+maxlen`, and pointer overflow is UB, so that means that a check
of the form `end < *p` will always be false because it can only be true
on pointer overflow. In particular, the compiler simplifies this to
`maxlen < 0` which is always false because maxlen is unsigned.
2024-04-03 18:15:56 +02:00
Niels Dossche
15259a0a6c Factor out common "first container's child" code 2024-04-03 18:15:43 +02:00
Niels Dossche
b7bc41341c Remove random newline 2024-04-03 18:15:43 +02:00
Niels Dossche
fc9b58f602 Remove duplicated code for entity vs notation handling 2024-04-03 18:15:43 +02:00
Niels Dossche
fa4d8cd4fa Cleanup create_notation()
We're already clearing memory, and we can merge the declaration and
assignment.
2024-04-03 18:15:43 +02:00
Niels Dossche
aa19461151 Don't use a heap allocation to track the current item 2024-04-03 18:15:43 +02:00
Niels Dossche
6de0486e19 Express php_dom_libxml_notation_iter() using php_dom_libxml_hash_iter() 2024-04-03 18:15:43 +02:00
Niels Dossche
f02fd58809 Get rid of impossible error branch 2024-04-03 18:15:43 +02:00
Niels Dossche
88449f6798 Simplify control flow for special case of php_dom_iterator_move_forward() 2024-04-03 18:15:43 +02:00
Niels Dossche
899b916f71 Merge declarations and assignments in php_dom_iterator_move_forward() 2024-04-03 18:15:43 +02:00
David CARLIER
7a3516cca5 zend_alloc trailing 1 calculation helper ZEND_ATTRIBUTE_CONST addition. (#13874) 2024-04-03 13:46:07 +01:00
Ilija Tovilo
e5f4cdd62f Fix test that behaves differently w and w/o opcache 2024-04-03 13:24:57 +02:00
David CARLIER
7db7c420f1 ext/pcntl: pcntl_unshare minor error message clarification (for EINVAL). (#13872)
it is not necessarily a bad flag but can just be unsupported by the
current kernel.
2024-04-02 23:26:07 +01:00
Niels Dossche
04e0d80554 Optimize levenshtein a bit for memory usage (#13830)
When all costs are equal, levenshtein fulfills the requirements
of being a metric. A metric is symmetric, so we can swap the strings in
that case. Since we use rows of a partial matrix of length |string2| we
can make the choice of using string1 instead if |string1| < |string2|,
which will optimize memory usage and CPU time.
2024-04-02 23:00:10 +02:00
Bob Weinand
33a523f64e Add missing show_output to test after merge of e7462bff19
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2024-04-02 18:39:20 +02:00
Niels Dossche
248b5f5b0f Remove useless NULL-check in phpdbg_print (#13853)
&method->op_array cannot possibly be NULL because it takes a pointer to
a field of method.
2024-04-02 18:17:21 +02:00