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

142628 Commits

Author SHA1 Message Date
Daniel Scherzer
d6c16c617b Update versions for PHP 8.5.0beta2 php-8.5.0beta2 2025-08-26 14:24:37 +03:00
Derick Rethans
7382895c22 Change script to define 'ZEND_VM_GEN_KIND' instead of 'ZEND_VM_KIND' for internal usage 2025-08-26 11:36:10 +01:00
Derick Rethans
5cf4861f7f Add ZEND_VM_KIND constant 2025-08-26 11:36:10 +01:00
Derick Rethans
7cf14848da Add missing definition 2025-08-26 11:36:10 +01:00
Derick Rethans
4d64e605f9 Fix deprecation warning 2025-08-26 11:36:10 +01:00
Daniel Scherzer
0b326dcbab [RFC] FILTER_THROW_ON_FAILURE (#18896)
https://wiki.php.net/rfc/filter_throw_on_failure
2025-08-26 03:16:39 -07:00
Tim Düsterhus
1193823541 uri: Clean up uri_parser_rfc3986.c (#19586)
* uri: Unify string creation in `php_uri_parser_rfc3986_scheme_read()`

* uri: Remove useless non-NULL assertions in uri_parser_rfc3986.c

The value of `uriparser_uri` is dereferenced *immediately* after the assertion,
making it redundant for both the human reader and the compiler. In case of the
normalized_uri, the pointer is trivially non-NULL, since it is referring to a
struct member at not-the-first position.

Generally speaking, unless something is checked for `NULL` one can assume it to
never be `NULL`.

* uri: Add `has_text_range()` helper to uri_parser_rfc3986.c
2025-08-26 09:28:21 +02:00
Arnaud Le Blanc
6f32e1c690 Deprecate driver specific PDO constants
RFC: https://wiki.php.net/rfc/deprecations_php_8_5.

Closes GH-19526
2025-08-26 09:06:19 +02:00
Gina Peter Banyard
99068da2b1 Update NEWS/UPGRADING for $http_response_header deprecation 2025-08-25 23:46:11 +02:00
Gina Peter Banyard
8a5972fd83 ext/standard: Deprecate $http_response_header (#19464)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_http_response_header_predefined_variable
2025-08-25 22:43:26 +01:00
Gina Peter Banyard
e87767686c Core changes should be first and then other extension are alphabetical 2025-08-25 22:28:39 +02:00
Gina Peter Banyard
1c1f08c282 Update NEWS/UPGRADING for disable_classes removal 2025-08-25 22:27:17 +02:00
Gina Peter Banyard
f4e2e91d4b core: Remove disable_classes INI setting
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#remove_disable_classes_ini_setting

This took longer to merge than expected but the initial motivation from 2 years ago still applied:

As described in the email to the PHP internals list [1] this feature is fundamentally broken and pointless.

Only internal classes can be disable which brings the following observation. On a minimal build of PHP, with only the mandatory extensions enabled, there are 148 classes/interfaces/traits defined. [2]

Other than the SPL ones (and even then), disabling any of these classes will cause issues within the engine.
Moreover, the SPL ones are not a security concern.

Therefore, any other class that can be disabled must come from an extension that can be disabled altogether. And "disabling" a class from an extension without disabling said extension will render it useless anyway.

If a hosting provided is concerned about an extension, then it should not enable it in the first place. Not break it ad hoc.

Considering the above, I cannot see how this functionality was ever useful.

This is in stark contrast to the disable_functions INI setting, which can be used to selectively remove functionality of an extension without breaking it overall.

What makes this setting particularly broken is that it does not unregister the class, it only overwrites the create CE handler to emit a warning and purge the properties and function hashtables. This leads to various use after free, segfaults, and broken expectations for the engine and extensions which define said classes. On top of that, it is possible to actually instantiate such a class (and even classes which actually disallow this like ext/imap) in userland, and pass it to function that are typed against said class without raising a TypeError. However, when trying to do anything with said object stuff is going to explode in countless ways.

[1] https://news-web.php.net/php.internals/120896
[2] https://gist.github.com/Girgias/63d55ba1e50b580412b004046daed02b
2025-08-25 21:16:55 +01:00
Tim Düsterhus
5d5305d99d uri: Properly prefix symbols in uri_parser_*.[ch] (#19554)
* uri: Remove unnecessary forward declaration of `uriparser_free_uri()`

* uri: Properly prefix symbols in uri_parser_rfc3986.[ch]

* uri: Make `#define`s in uri_parser_whatwg proper typed constants

* uri: Properly prefix symbols in uri_parser_whatwg.[ch]

* NEWS
2025-08-25 18:58:00 +02:00
Ilija Tovilo
71a3226a46 Prohibit pipe & arrow function combination that leads to confusing parse trees
See https://externals.io/message/128473
Closes GH-19533
2025-08-25 17:24:55 +02:00
Ilija Tovilo
6497c6c455 Don't substitute self/parent with anonymous class
Fixes GH-18373
Closes GH-19537
2025-08-25 17:08:29 +02:00
Tim Düsterhus
5127a229bf uri: Mark local pointers as const in URI parser implementations (#19581)
* uri: Mark local pointers as `const` in uri_parser_whatwg.c

* uri: Mark local pointers as `const` in uri_parser_rfc3986.c
2025-08-25 15:08:29 +02:00
Daniel Scherzer
7e5ad5caf8 ext/intl: Add #[\Deprecated] to U_MULTIPLE_DECIMAL_SEPERATORS constant (#19564) 2025-08-25 03:08:46 -07:00
Timo Tijhof
27a1abc1fa README: Fix non-existent iconv in macOS instruction (#19475)
Follows-up 22e444c5c7 (GH-18670). There is currently no formula called
"iconv". [1][2]

```
$ brew install iconv
Warning: No available formula with the name "iconv". Did you mean icon or cconv?
```

There package is called "libiconv". [3]

Once installed, `./configure` still fails due to a discovery issue.

```
$ ./configure --enable-debug
…
checking for libiconv... no
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>
```

In 2020, as part of the switch from Intel to ARM, Homebrew adopted /opt
as the standard location instead of /usr/local. [4][5]

Rather than complicating the README with a mandatory `--with-iconv`
path (or --without-iconv) for macOS users, improve the discovery
to support Homebrew's new location.

[1]: https://brew.sh/
[2]: https://github.com/Homebrew/homebrew-core/.
[3]: https://formulae.brew.sh/formula/libiconv
[4]: https://apple.stackexchange.com/a/437622/33762
[5]: https://docs.brew.sh/FAQ#why-is-the-default-installation-prefix-opthomebrew-on-apple-silicon
2025-08-25 02:50:40 -07:00
Daniel Scherzer
1cbaa60807 ext/reflection: Align return types and values (#19567)
Return `true` or `false` for boolean functions, use `zend_result` for functions
that return `SUCCESS` or `FAILURE`.
2025-08-25 01:52:46 -07:00
Daniel Scherzer
4731245952 ext/session: Add #[\Deprecated] to SID constant (#19566) 2025-08-25 01:52:35 -07:00
Daniel Scherzer
b360cf8c28 ext/hash: Add #[\Deprecated] to MHASH_* constants (#19565) 2025-08-25 01:52:25 -07:00
Tim Düsterhus
948ab104b0 Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for d74901ae1a
2025-08-25 09:20:19 +02:00
Tim Düsterhus
ec9be2eb03 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for d74901ae1a
2025-08-25 09:19:57 +02:00
Tim Düsterhus
96c0bc55bb NEWS for d74901ae1a
NEWS was missing for 8.3, but was in 8.4:
62e30ecae1
2025-08-25 09:19:01 +02:00
Niels Dossche
fc0dd9d4ca Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix Windows build
2025-08-25 00:23:16 +02:00
Niels Dossche
3690df022b Fix Windows build 2025-08-25 00:23:09 +02:00
Niels Dossche
a1eea30fcc Merge branch 'PHP-8.4'
* PHP-8.4:
  Sync lexbor with master on PHP 8.4
2025-08-25 00:09:05 +02:00
Niels Dossche
c66af62511 Sync lexbor with master on PHP 8.4 2025-08-25 00:06:18 +02:00
Niels Dossche
e976926843 Update lexbor to lexbor/lexbor@b46db664 2025-08-24 23:51:35 +02:00
Gina Peter Banyard
e20095a2cf Zend: Move coercion related tests into a subfolder 2025-08-24 18:25:34 +02:00
David CARLIER
30f73aab5e zend: optimisation for zend_get_page_size for macos. (#19494)
Using the getpagesize() call instead which saves one call.
2025-08-24 13:53:26 +01:00
Gina Peter Banyard
9b27fdbe52 Normalize version number strings 2025-08-24 12:00:31 +01:00
Gina Peter Banyard
fb27ff958c Clarify usage of @deprecated annotation in stubs
To indicate that this was used prior to the \Deprecated attribute being usable on those symbols.
2025-08-24 12:00:31 +01:00
Alexandre Daubois
273d9e2901 [RFC] Deprecate closure binding issues (#19510)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-24 00:10:18 -07:00
Jorg Adam Sowa
d6d0a2a217 remove safe_mode leftovers (#19552) 2025-08-24 03:55:15 +01:00
Gina Peter Banyard
f041c13c94 Update NEWS/UPGRADING for ++ on string deprecation 2025-08-23 15:40:15 +02:00
Gina Peter Banyard
93716bece4 Enact follow-up phase of the "Path to Saner Increment/Decrement operators" RFC (#19374)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#enact_follow-up_phase_of_the_path_to_saner_incrementdecrement_operators_rfc
2025-08-23 14:36:39 +01:00
Gina Peter Banyard
e27c436607 Merge branch 'PHP-8.4' 2025-08-23 15:28:56 +02:00
Gina Peter Banyard
20c274b688 Merge branch 'PHP-8.3' into PHP-8.4 2025-08-23 15:27:25 +02:00
Gina Peter Banyard
e46f77c861 Update NEWS for Phar memory leak fix 2025-08-23 15:27:01 +02:00
Gina Peter Banyard
f5a3a642c6 ext/phar: Fix memory leaks when verifying OpenSSL signature (#19563) 2025-08-23 14:25:42 +01:00
Kuba Werłos
414e521f1a Remove redundant PARSER_MODE() call (#19559) 2025-08-23 09:51:56 +02:00
Kuba Werłos
94d0b41db1 Fix corrupted result after recursive tokenization during token_get_all()
Fixes GH-19507
Closes GH-19547

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2025-08-22 18:29:50 +02:00
Arnaud Le Blanc
73b98a3858 TAILCALL VM
Introduce the TAILCALL VM, a more efficient variant of the CALL VM:

 * Each opcode handler tailcalls the next opcode handler directly instead of
   returning to the interpreter loop. This eliminates call and interpreter loop
   overhead.
 * Opcode handlers use the preserve_none calling convention to eliminate
   register saving overhead.
 * preserve_none uses non-volatile registers for its first arguments, so
   execute_data and opline are usually kept in these registers and no code is
   required to forward them to the next handlers.

Generated machine code is similar to a direct-threaded VM with register pinning,
like the HYBRID VM.

JIT+TAILCALL VM also benefits from this compared to JIT+CALL VM:

 * JIT uses the registers of the execute_data and opline args as fixed regs,
   eliminating the need to move them in prologue.
 * Traces exit by tailcalling the next handler. No code is needed to forward
   execute_data and opline.
 * No register saving/restoring in epilogue/prologue.

The TAILCALL VM is used when the HYBRID VM is not supported, and the compiler
supports the musttail and preserve_none attributes: The HYBRID VM is used when
compiling with GCC, the TAILCALL VM when compiling with Clang>=19 on x86_64 or
aarch64, and the CALL VM otherwise.

This makes binaries built with Clang>=19 as fast as binaries built with GCC.
Before, these were considerably slower (by 2.8% to 44% depending on benchmark,
and by 5% to 77% before 76d7c616bb).

Closes GH-17849
Closes GH-18720
2025-08-22 18:05:52 +02:00
Arnaud Le Blanc
c6f02a4ee3 Merge branch 'PHP-8.4'
* PHP-8.4:
  Differenciate WeakMaps from bare HashTables used as weak maps for GC purposes
2025-08-22 16:39:05 +02:00
Arnaud Le Blanc
62e30ecae1 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Differenciate WeakMaps from bare HashTables used as weak maps for GC purposes
2025-08-22 16:33:08 +02:00
Arnaud Le Blanc
d74901ae1a Differenciate WeakMaps from bare HashTables used as weak maps for GC purposes
Since cbf67e4, the GC needs to find all WeakMaps referencing a weakly
referenced object. Doing so, it treats all ZEND_WEAKREF_TAG_MAP as WeakMap
instances.

However, a ZEND_WEAKREF_TAG_MAP reference may be a bare HashTable when
zend_weakrefs_hash_add() is used.

Introduce a new tag, ZEND_WEAKREF_TAG_BARE_HT, and use this tag when weakly
referencing an object from a bare HashTable. Ignore such references in GC.

Fixes GH-19543
Closes GH-19544

Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-08-22 16:32:30 +02:00
Ilija Tovilo
ba5305dfb5 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix signed int overflow in scanner
2025-08-22 16:26:46 +02:00
Ilija Tovilo
7f9809c438 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix signed int overflow in scanner
2025-08-22 16:26:30 +02:00