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

141512 Commits

Author SHA1 Message Date
Máté Kocsis
400b7b8c74 Add Lexbor files for URL handling (#18656)
Relates to #14461 and https://wiki.php.net/rfc/url_parsing_api
2025-05-27 13:06:02 +02:00
Máté Kocsis
d585a5609d Add ext/uri skeleton along with uriparser (#18658)
Relates to https://github.com/php/php-src/pull/14461/ and https://wiki.php.net/rfc/url_parsing_api
2025-05-27 08:16:24 +02:00
Saki Takamachi
c0865ac013 [skip ci] UPGRADING for #18413 and #18626 2025-05-27 13:47:39 +09:00
DanielEScherzer
de785f9127 Fix bad upmerge from GH-18464 (#18666)
This led to recursion being added to but not removed from internal constants.
2025-05-26 12:40:11 -07:00
Niels Dossche
0a2f367e19 Fix date test 2025-05-26 20:43:44 +02:00
David Carlier
5a7920ba60 ext/sockets: socket_shutdown() having proper constants for mode.
close GH-18648
2025-05-26 18:48:21 +01:00
Niels Dossche
cec079ee72 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in tidy output handler on error
  Fix leaks with multiple calls to DatePeriod iterator current()
2025-05-26 19:42:39 +02:00
Niels Dossche
06f592820d Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in tidy output handler on error
  Fix leaks with multiple calls to DatePeriod iterator current()
2025-05-26 19:42:20 +02:00
Niels Dossche
b39e17b06c Fix memory leak in tidy output handler on error
Closes GH-18649.
2025-05-26 19:41:11 +02:00
Niels Dossche
ff2c7dc0f8 Fix leaks with multiple calls to DatePeriod iterator current()
Destroy the old value first. We can't skip recreating the value because
the object may have been changed in between calls.

Closes GH-18624.
2025-05-26 19:40:41 +02:00
Jessica Smith
042a975238 ext/session: Fix GH-18634 (#18653)
Show warning when saving session if a pipe character is used in one of the $_SESSION keys

Fixes #18634
2025-05-26 11:17:25 +01:00
Saki Takamachi
462fd4dffe Small change SIMD codes (#18626)
* use zend_simd.h in zend_accelerator_util_funcs.c

* use zend_simd.h in mbstring

* Remove unnecessary SSE3 includes
2025-05-26 16:32:27 +09:00
Daniel Scherzer
04522cd1c4 Merge branch 'PHP-8.4'
* PHP-8.4:
  Reapply GH-17712 with a fix for internal class constants (#18464)
2025-05-25 16:51:18 -07:00
DanielEScherzer
cd751f98cb Reapply GH-17712 with a fix for internal class constants (#18464)
Add recursion protection when emitting deprecation warnings for class
constants, since the deprecation message can come from an attribute that is
using the same constant for the message, or otherwise result in recursion.

But, internal constants are persisted, and thus cannot have recursion
protection. Otherwise, if a user error handler triggers bailout before the
recursion flag is removed then a subsequent request (e.g. with `--repeat 2`)
would start with that flag already applied. Internal constants can presumably
be trusted not to use deprecation messages that come from recursive attributes.

Fixes GH-18463
Fixes GH-17711
2025-05-25 16:43:36 -07:00
David CARLIER
7e956f879e ext/soap: SoapServer::handle() reduce retval scope. (#18657)
might have been a relic of past modifications,
but pushing it down to the actual first case of error path.
2025-05-25 22:15:31 +01:00
Niels Dossche
c7db07eae8 Remove duplicated reflection test
[ci skip]

This is already tested in 016.phpt.
2025-05-25 14:24:53 +02:00
Niels Dossche
085abe932a Pass hash table directly in tokenizer (#18650)
This avoids dereferences by Z_ARRVAL_P().
2025-05-25 14:23:50 +02:00
Máté Kocsis
7f59fccd52 Create separate lexbor extension (#18538)
An always enabled lexbor extension is added, containing the lexbor library that was separated from ext/dom extension in preparation of https://wiki.php.net/rfc/url_parsing_api. While at it, the lexbor library is upgraded to 2.5.0.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2025-05-25 14:12:44 +02:00
David Carlier
4076324c6f Merge branch 'PHP-8.4' 2025-05-25 12:53:54 +01:00
David Carlier
78f03cd5f2 Merge branch 'PHP-8.3' into PHP-8.4 2025-05-25 12:53:44 +01:00
David Carlier
5d4846b241 ext/ldap: simplify ldap_connect() workflow, fix url leak.
delaying the object creation only before ldap initialisation.
fix forgotten url freeing on TLS error code path.

close GH-18645
2025-05-25 12:53:28 +01:00
Niels Dossche
b8fa1657ff Avoid string copies in ext/intl after string conversion (#18636)
Introduces intl_convert_utf8_to_utf16_zstr() to convert a UTF-8 string
to a UTF-16 string zend_string* instance. This way we avoid a double
copy later from a UChar* into a zend_string*.
2025-05-25 12:29:36 +02:00
David CARLIER
16e154a2c4 ext/mbstring: mb_ereg*_replace remove unreachable code. (#18646) 2025-05-25 10:44:59 +01:00
David CARLIER
caf0a5352a ext/tidy: simplify tidy_instantiate (#18647) 2025-05-25 10:41:16 +01:00
Máté Kocsis
ab80e092fb Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix build on Apple Clang 17+ (#18629)
2025-05-24 22:30:58 +02:00
Máté Kocsis
bc32d806dd Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix build on Apple Clang 17+ (#18629)
2025-05-24 22:30:02 +02:00
Máté Kocsis
772479ea2f Fix build on Apple Clang 17+ (#18629)
Fixing "invalid cpu feature string for builtin" errors that started to appear on Apple Clang 17.0.0
2025-05-24 22:26:06 +02:00
Niels Dossche
ac3eb678aa Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leaks in php_http.c when call_user_function() fails
2025-05-24 21:54:50 +02:00
Niels Dossche
83755748fd Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leaks in php_http.c when call_user_function() fails
2025-05-24 21:54:45 +02:00
Niels Dossche
a44e3f442f Fix memory leaks in php_http.c when call_user_function() fails
retval can be refcounted but is not destroyed.

Closes GH-18638.
2025-05-24 21:54:19 +02:00
Niels Dossche
25e60d6ab1 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when calloc() fails in php_readline_completion_cb()
  Fix GH-18641: Accessing a BcMath\Number property by ref crashes
2025-05-24 20:39:59 +02:00
Niels Dossche
72127ffac5 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when calloc() fails in php_readline_completion_cb()
2025-05-24 20:39:38 +02:00
Niels Dossche
c9781111e1 Fix memory leak when calloc() fails in php_readline_completion_cb()
Closes GH-18637.
2025-05-24 20:39:14 +02:00
Niels Dossche
64d511ef29 Fix GH-18641: Accessing a BcMath\Number property by ref crashes
The properties are virtual so we need a custom get_property_ptr_ptr
handler.

Closes GH-18637.
2025-05-24 20:38:33 +02:00
Niels Dossche
5187ff2d17 Fix GH-18566: [intl] Weird numeric sort in Collator
This aligns the behaviour with normal (non-intl) asort() by making the following changes:
  - Use the same trailing whitespace logic as Zend's is_numeric_ex()
  - Don't allow errors on trailing data

Targeting master because of the BC break.

Closes GH-18632.
2025-05-24 14:57:34 +02:00
Niels Dossche
5e21ffe09a Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in intl_datetime_decompose()
2025-05-24 14:56:41 +02:00
Niels Dossche
7efe96d504 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in intl_datetime_decompose()
2025-05-24 14:56:04 +02:00
Niels Dossche
d6836fb345 Fix memory leak in intl_datetime_decompose()
Closes GH-18635.
2025-05-24 14:55:41 +02:00
Niels Dossche
2a9ea2c9f5 Drop FIXME in pcntl_signal_dispatch() (#18633) 2025-05-24 14:35:32 +02:00
David Carlier
dfff6ac852 Merge branch 'PHP-8.4' 2025-05-22 20:47:36 +01:00
David Carlier
c00d7e056a Merge branch 'PHP-8.3' into PHP-8.4 2025-05-22 20:47:25 +01:00
David Carlier
c30bddc18f Fix GH-18617: socket_import_file_descriptor return check.
to_zval_read_fd_array() helper when retrieving the socket protocol did
not check it.

close GH-18617
2025-05-22 20:46:18 +01:00
David Carlier
4671f8510c ext/sockets: UDP_SEGMENT support.
UDP segmentation offload is an optimisation attempt by sending multiple
large enough datagrams over UDP which reduces syscalls as by default,
they have to be broke down in small UDP packets, it is better if the
hardware supports it, other handed down to the software implementation.

close GH-18213
2025-05-22 20:32:29 +01:00
Gina Peter Banyard
ea2656277b Fix INI setting requirements for test with opcache
Closes GH-18551
2025-05-22 14:18:41 +01:00
Niels Dossche
cd43536b27 Drop useless cast 2025-05-21 19:54:09 +02:00
Niels Dossche
2eaf319b45 Implement php_url_encode_to_smart_str() and use it in http_build_query()
This avoids temporary allocations and some copies.

For this benchmark:
```php
for ($i=0;$i<2000000;$i++) {
  http_build_query([999999 => 'foo', 'aaab' => 'def', 'aaaaa'=>1, 'aaaaaaaa' => 'a']);
}
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php ../buildquery.php
  Time (mean ± σ):     298.9 ms ±   7.3 ms    [User: 295.6 ms, System: 2.3 ms]
  Range (min … max):   293.6 ms … 314.0 ms    10 runs

Benchmark 2: ./sapi/cli/php_old ../buildquery.php
  Time (mean ± σ):     594.8 ms ±   8.6 ms    [User: 590.8 ms, System: 2.4 ms]
  Range (min … max):   586.3 ms … 616.1 ms    10 runs

Summary
  ./sapi/cli/php ../buildquery.php ran
    1.99 ± 0.06 times faster than ./sapi/cli/php_old ../buildquery.php
```

For this benchmark:
```php
for ($i=0;$i<2000000;$i++) {
  http_build_query(['test' => 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']);
}
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php ../buildquery.php
  Time (mean ± σ):     188.4 ms ±   6.7 ms    [User: 184.6 ms, System: 2.9 ms]
  Range (min … max):   182.0 ms … 205.4 ms    14 runs

Benchmark 2: ./sapi/cli/php_old ../buildquery.php
  Time (mean ± σ):     323.9 ms ±   8.7 ms    [User: 319.8 ms, System: 2.7 ms]
  Range (min … max):   318.0 ms … 341.2 ms    10 runs

Summary
  ./sapi/cli/php ../buildquery.php ran
    1.72 ± 0.08 times faster than ./sapi/cli/php_old ../buildquery.php
```
2025-05-21 19:54:09 +02:00
Niels Dossche
1a23a411a1 Use zend_string_efree() for temporary strings
This avoids some assembly code bloat.
2025-05-21 19:54:09 +02:00
Niels Dossche
33ae76405f Use zend_string for arg_separators
This allows us to avoid a call to `zend_ini_str` which took 6% of the
profile on my i7-4790 for a call to `http_build_query`. Now we can just
grab the value from the globals.
In other files this can avoid some length recomputations.
2025-05-21 19:54:09 +02:00
Niels Dossche
ed3096913d Merge branch 'PHP-8.4'
* PHP-8.4:
  Add missing filter cleanups on phar failure
2025-05-21 19:50:45 +02:00
Niels Dossche
f9785c230c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add missing filter cleanups on phar failure
2025-05-21 19:48:20 +02:00