Commit Graph

137921 Commits

Author SHA1 Message Date
Niels Dossche
cc0464268d
Avoid copying the local name in SOAP's parse_namespace() (#15862)
The local name is either the entire input or is the last part, so we
never need to make a copy.
2024-09-12 22:41:45 +02:00
Ilija Tovilo
ffb440550c
Use APPLY_STOP in pcre_clean_cache() (GH-15839)
Once num_clean has reached 0, we never remove any more elements anyway.

Closes GH-15839
2024-09-12 22:32:23 +02:00
Gina Peter Bnayard
1facbc385a ext/phar: Use normal variable instead of macro 2024-09-12 20:41:51 +01:00
Gina Peter Bnayard
ae9d8099c2 ext/phar: Add comment about include 2024-09-12 20:41:51 +01:00
Gina Peter Bnayard
d486d65962 ext/phar: Reduce scope of some variables 2024-09-12 20:41:51 +01:00
Gina Peter Bnayard
6adffebeb8 ext/phar: Use zend_result as return value
Also simplify some calls to functions returning zend_result
2024-09-12 20:41:51 +01:00
Peter Kokot
ea4e8d513c
Autotools: Check copy_file_range with AC_COMPILE_IFELSE (#15858)
Running the test program is not required as compilation step already
errors out if needed.
2024-09-12 20:56:56 +02:00
David Carlier
adfd7de5c3
Merge branch 'PHP-8.3' 2024-09-12 18:19:53 +01:00
David Carlier
32358173c9
Fix GH-15729 PDO tests name conflicts.
close GH-15765
2024-09-12 18:19:20 +01:00
Dmitry Stogov
98f07fcfca
Fix more issues reported in GH-15852
* Fix incorrect register allocation

* Avoid IR binding/spilling conflict

* Add missing type guard
2024-09-12 20:19:11 +03:00
Gina Peter Bnayard
ab99161444 ext/standard/versioning.c: Slightly refactor compare_special_version_forms() 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
8109d21065 ext/standard/url.c: Stop exposing php_replace_controlchars_ex()
This is not used from a quick search on SourceGraph and this allows us to refactor it
2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
d45eb46c97 ext/standard/type.c: Remove unused include 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
85e6688791 ext/standard/string.c: Remove to(upper|lower) PHP API in favour of Zend APIs 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
1b87772f40 ext/standard/string.c: Refactor php_spn_common_handler()
Main objective is to remove the PHP_STR_STR(C)SPN symbols which are only used with this static function
2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
312f789e22 ext/standard/quot_print.c: Mark readonly string as const 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
5c191a45d9 ext/standard/quot_print.c: Minor refactoring to php_hex2int()
We already check, and assume, that the value is hexadecimal
2024-09-12 18:13:01 +01:00
DanielEScherzer
3c8fd93dcf
[skip ci] zend_compile.h: ZEND_ACC_DEPRECATED can be used for class constants (#15848)
Support for deprecating class constants was added to implement the PHP 8.3
deprecations in #11615, but the documentation update was missed.

[skip ci]
2024-09-12 17:52:43 +01:00
Arnaud Le Blanc
c21899a9f0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Do not remove -O0 in the middle of a flag
  Fix removal of optimization cflags in debug builds (#9647)
2024-09-12 13:12:51 +02:00
Arnaud Le Blanc
be1bf3f35e
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Do not remove -O0 in the middle of a flag
  Fix removal of optimization cflags in debug builds (#9647)
2024-09-12 13:11:49 +02:00
Arnaud Le Blanc
c639614346
Do not remove -O0 in the middle of a flag
Fixes GH-15826
Closes GH-15828

Co-authored-by: Peter Kokot <petk@php.net>
2024-09-12 13:08:54 +02:00
Arnaud Le Blanc
60c2687712
Fix removal of optimization cflags in debug builds (#9647)
Discard known '-O' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
2024-09-12 13:08:44 +02:00
Christoph M. Becker
66060b1a9e
Support building ext/gd without libxpm on Windows (GH-15846)
For GD, libxpm is an optional dependency, and we should treat it as
such, i.e. if the library is not found, we build ext/gd without XPM
support.

This should also be done for other optional dependencies (like libjpeg),
but since we're close to PHP 8.4.0RC1, we postpone that.  However, wrt
libxpm[1] we're taking action immediately, so that we can ship builds
without XPM support, or at least custom builds without XPM support are
possible without modifying the sources.

[1] <https://news-web.php.net/php.internals/125502>
2024-09-12 12:29:18 +02:00
Niels Dossche
306a51951f
Avoid allocating memory in soap get_function() (#15843) 2024-09-11 23:50:53 +02:00
David Carlier
81d580e334
Merge branch 'PHP-8.3' 2024-09-11 21:20:14 +01:00
David Carlier
eb460229ad
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-11 21:19:58 +01:00
David Carlier
503d9145e0
Fix GH-15712: overflow on float print with precision ini large value.
When allocating enough room for floats, the allocator used overflows with
large ndigits/EG(precision) value which used an signed integer to
increase the size of thebuffer.
Testing with the zend operator directly is enough to trigger
the issue rather than higher level math interface.

close GH-15715
2024-09-11 21:19:07 +01:00
David Carlier
ea0937b550
Merge branch 'PHP-8.3' 2024-09-11 21:16:26 +01:00
David Carlier
b975b6c9ab
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-11 21:15:42 +01:00
David Carlier
791a6ef19c
Fix GH-15613: unpack on format hex strings repeater value.
close GH-15615
2024-09-11 21:14:27 +01:00
DanielEScherzer
4ffc971f62
readline: inline _readline_long_zval() function (#15840)
Unneeded wrapper around the `ZVAL_LONG()` macro
2024-09-11 20:43:21 +02:00
Niels Dossche
0d9b039568
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15837: Segmentation fault in ext/simplexml/simplexml.c
2024-09-11 20:40:01 +02:00
Niels Dossche
bc20b403cf
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15837: Segmentation fault in ext/simplexml/simplexml.c
2024-09-11 20:39:30 +02:00
Niels Dossche
b5834c12d4
Fix GH-15837: Segmentation fault in ext/simplexml/simplexml.c
We should check if the iterator data is still valid, because if it
isn't, then the type info is UNDEF, but the pointer value may be
dangling.

Closes GH-15841.
2024-09-11 20:38:38 +02:00
Niels Dossche
ded8fb79bd
Fix UAF issues with PCRE after request shutdown
There are two related issues, each tested.

First problem:
What happens is that on the CLI SAPI we have a per-request pcre cache,
and on there the request shutdown for the pcre module happens prior to
the remaining live object destruction. So when the SPL object wants to
clean up the regular expression object it gets a use-after-free.

Second problem:
Very similarly, the non-persistent resources are destroyed after request
shutdown, so on the CLI SAPI the pcre request cache is already gone, but
if a userspace stream references a regex in the pcre cache, this breaks.

Two things that come immediately to mind:
  -  We could fix it by no longer treating the CLI SAPI special and just use
     the same lifecycle as the module. This simplifies the pcre module code
     a bit too. I wonder why we even have the separation in the first place.
     The downside here is that we're using more the system allocator
     than Zend's allocator for cache entries.
  -  We could modify the shutdown code to not remove regular expressions
     with a refcount>0 and modify php_pcre_pce_decref code such that it
     becomes php_pcre_pce_decref's job to clean up when the refcount
     becomes 0 during shutdown. However, this gets nasty quickly.

I chose the first solution here as it should be reliable and simple.

Closes GH-15064.
2024-09-11 18:49:19 +02:00
Derick Rethans
9698ad2fc0
Merge branch 'PHP-8.3' 2024-09-11 17:44:18 +01:00
Derick Rethans
b0bead499c
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-11 17:44:11 +01:00
Derick Rethans
34dcea82f9
Merge branch 'import-timelib-2022.12' into PHP-8.2 2024-09-11 17:43:55 +01:00
Derick Rethans
8a8859bce7
Fixed regression: Using more than one sign is now OK again when using modify() 2024-09-11 17:43:23 +01:00
Derick Rethans
40d06fb645
Import timelib 2022.12 2024-09-11 17:30:57 +01:00
Derick Rethans
e255889fea
Merge branch 'PHP-8.3' 2024-09-11 16:41:35 +01:00
Derick Rethans
9ebdbe2f41
Merge branch 'PHP-8.2' into PHP-8.3 2024-09-11 16:41:30 +01:00
Derick Rethans
e700804a68
Merge remote-tracking branch 'derickr/GH-15582' into PHP-8.2 2024-09-11 16:41:19 +01:00
Derick Rethans
f752e23cff
Fix GH-15582: Crash when not calling parent constructor of DateTimeZone 2024-09-11 16:37:40 +01:00
Dmitry Stogov
32d67855e6
Update IR
IR commit: 4cb5282c895908cfd4547ab460de86d189d15177

Fixes GH-15662: Segmentation fault in ext/opcache/jit/ir/ir_cfg.c
2024-09-11 16:03:38 +03:00
tekimen
ee715d2049
[skip ci] Add NEWS for GH-15824 (GH-15835)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-09-11 12:57:48 +02:00
DanielEScherzer
2ced1c926b
Add ReflectionProperty::isDynamic() as an alternative to isDefault() (#15758)
Dynamic properties are generally referred to as "dynamic" properties, while
non-dynamic properties are not commonly referred to as "default" properties.
Thus, the existing method `ReflectionProperty::isDefault()` has a non obvious
name; while an alias could be added for `isNotDynamic()`, a new `isDynamic()`
method seems cleaner. The new method returns the opposite of `isDefault()`;
dynamic properties are not present on the class by default, and properties
present by default are not added dynamically.

Closes GH-15754
2024-09-11 10:51:38 +02:00
Niels Dossche
c9862ba56e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #62900: Wrong namespace on xsd import error message
2024-09-11 09:21:59 +02:00
Niels Dossche
a0749bb473
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #62900: Wrong namespace on xsd import error message
2024-09-11 09:19:51 +02:00
Niels Dossche
7a67fb0315
Fix bug #62900: Wrong namespace on xsd import error message
The one error message indeed had a wrong namespace, and in general they
weren't very descriptive, this also makes them more descriptive.

Furthermore, two additional bugs were fixed:
- Persistent memory leak of `location`.
- UAF issues when printing the error message.

Closes GH-15830.
2024-09-11 09:12:51 +02:00