1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00
Commit Graph

137862 Commits

Author SHA1 Message Date
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
Niels Dossche 3665ab0118 Fix GH-15657: Segmentation fault in ext/opcache/jit/ir/dynasm/dasm_x86.h
The crash happens because the zend_persist.c code tries to JIT the hook's
op_array while the JIT buffer memory is still protected. This happens in
`zend_persist_property_info` called via `zend_persist_class_entry`
through the inheritance cache.

We shouldn't JIT the property hook code when persisting property info
for the inheritance cache.

This is a simple workaround by temporarily disabling the JIT so that the
property hook code is not JITted when persisting the property info.

An alternative solution would be to move the JITting of the property
hooks to a different place in zend_persist.c by doing an additional pass
over the classes.

Closes GH-15819.
2024-09-11 09:08:51 +02:00
tekimen dc5f3b9562 Fix GH-15824 mb_detect_encoding() invalid "UTF8" (#15829)
I fixed from strcasecmp to strncasecmp.
However, strncasecmp is specify size to #3 parameter.
Hence, Add check length to mime and aliases.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-09-11 09:40:35 +09:00
DanielEScherzer db545767e5 Rename ZEND_STR_DEPRECATED to ZEND_STR_DEPRECATED_CAPITALIZED (#15831)
To match other capitalized strings like `ZEND_STR_UNKNOWN_CAPITALIZED` and
`ZEND_STR_ARRAY_CAPITALIZED`. Since this known string was only added in PHP
8.4, no backwards compatibility alias is needed.
2024-09-10 22:45:23 +01:00
Pierrick Charron 7c2204c915 Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.25-dev
2024-09-10 15:27:29 -04:00
Pierrick Charron 6b75224f16 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  PHP-8.2 is now for PHP 8.2.25-dev
2024-09-10 15:26:58 -04:00
Pierrick Charron 7e722e3ba4 PHP-8.2 is now for PHP 8.2.25-dev 2024-09-10 15:26:28 -04:00
Niels Dossche 1cf98db425 Deduplicate Proxy-Authorization code from php_stream_url_wrap_http_ex() (#15818)
Extracts this code to a separate function to reduce code duplication.
2024-09-10 21:17:14 +02:00
Niels Dossche 520fce5607 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #73182: PHP SOAPClient does not support stream context HTTP headers in array form
2024-09-10 20:24:57 +02:00
Niels Dossche 2a95e3f02b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #73182: PHP SOAPClient does not support stream context HTTP headers in array form
2024-09-10 20:24:48 +02:00