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

1146 Commits

Author SHA1 Message Date
Tim Düsterhus
7134e69ab2 zend_globals: Embed in_autoload into zend_executor_globals (#21202)
* zend_globals: Embed `in_autoload` into `zend_executor_globals`

Nowadays virtually any PHP application is making use of autoloading, making the
lazy allocation of the `HashTable` struct a needless pointer indirection.

* zend_globals: Rename `in_autoload` to `autoload_current_classnames`

The old name `in_autoload` was somewhat misleading by implying a `bool`ean
value rather than a `HashTable`. Since the previous change to embed the
`HashTable` is breaking anyway, we can also rename it.

* UPGRADING.INTERNALS
2026-02-11 22:53:31 +01:00
Khaled Alam
32bd33983d Remove unreachable code after zend_error_noreturn calls (GH-20983) 2026-02-02 14:14:15 +01:00
Ilija Tovilo
084e409694 Remove zend_exception_save() and zend_exception_restore()
These are leftovers from the pre-PHP-7.0 era. This also implicitly solves
GH-20564 by not clearing exceptions before entering the autoloader.

Closes GH-20256
Fixes GH-20564
2026-01-16 20:18:51 +01:00
Arnaud Le Blanc
626f3c3c7c Unify arg info representation for internal and user functions
The arg_info member of zend_function is now always a zend_arg_info*. Before,
it was a zend_internal_arg_info* on internal functions, unless the
ZEND_ACC_USER_ARG_INFO flag was set.

Closes GH-19022
2025-12-15 16:50:49 +01:00
Gina Peter Banyard
7815ab9b22 Zend: add const qualifiers when possible for _zend_execute_data.func related uses (#20263)
The initial motivation was to see if it is possible to make the `func` field of `_zend_execute_data` constant.

For various reasons, this is not possible, but the added `const` qualifiers during this exploration remain useful.
2025-10-29 13:22:56 +00:00
Gina Peter Banyard
005d04aa96 zend_call_function: emit function deprecation before setting up call frame (#20264) 2025-10-23 16:30:46 +01:00
Ilija Tovilo
74c697cfaa Merge branch 'PHP-8.5'
* PHP-8.5:
  Don't bail when closing resources on shutdown
2025-10-14 22:20:13 +02:00
Ilija Tovilo
19a1600868 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Don't bail when closing resources on shutdown
2025-10-14 22:20:00 +02:00
Ilija Tovilo
55f4d4c909 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Don't bail when closing resources on shutdown
2025-10-14 22:19:46 +02:00
Ilija Tovilo
e6e39e680e Don't bail when closing resources on shutdown
Fixes GH-19844
Closes GH-19849
2025-10-14 22:19:17 +02:00
Ilija Tovilo
28fd7597ba Add first-class callable cache
This cache is implemented in two levels: A EG(callable_convert_cache) global
that maps zend_function pointers to a shared callable instance, and a
CALLABLE_CONVERT cache slot to remember the result of the hash table lookup.

Fixes GH-19754
Closes GH-19863
2025-10-03 01:04:56 +02:00
Gina Peter Banyard
ec31437973 Zend/zend_execute_API.c: use uint32_t type instead of int 2025-09-29 14:59:09 +01:00
Gina Peter Banyard
2f6afda40b Zend/zend_execute_API.c: reduce variable scope 2025-09-29 14:59:09 +01:00
Gina Peter Banyard
584ae5eec2 Zend/zend_execute_API.c: add const qualifiers 2025-09-29 14:59:09 +01:00
Tim Düsterhus
c9b175992c Zend: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle:

    @r1@
    identifier F;
    identifier p;
    typedef bool;
    parameter list [n1] PL1;
    parameter list [n2] PL2;
    @@

    F(PL1, bool p, PL2) {
    ...
    }

    @r2@
    identifier r1.F;
    expression list [r1.n1] EL1;
    expression list [r1.n2] EL2;
    @@

    F(EL1,
    (
    - 1
    + true
    |
    - 0
    + false
    )
    , EL2)
2025-09-24 18:51:40 +02:00
Tim Düsterhus
c32fbca874 Zend: Use true / false instead of 1 / 0 when assigning to bool
Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
2025-09-24 18:51:40 +02:00
Ilija Tovilo
4cc395ed3b Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix hard_timeout when zend-max-execution-timers is enabled
2025-09-11 14:51:19 +02:00
Ilija Tovilo
c733491e4b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix hard_timeout when zend-max-execution-timers is enabled
2025-09-11 14:50:57 +02:00
Appla
ed9430a5d1 Fix hard_timeout when zend-max-execution-timers is enabled
Closes GH-19786
2025-09-11 14:49:19 +02:00
Gina Peter Banyard
7bac9de94a Zend: refactor zend_call_method_if_exists() API
The objective of this is to stop relying on the fci.function_name zval field,
to see if in the future we can get rid of said field and fit an FCI/FCC pair in a single cache line
2025-07-30 12:02:41 +01:00
Tim Düsterhus
b43a7ac0e7 Zend: Make EG(fake_scope) a const zend_class_entry* (#19060) 2025-07-09 11:55:53 +02:00
Daniil Gentili
f6f0aed9f3 Allow using fast destruction path when ASAN is in use (#18835) 2025-06-30 18:37:20 +02:00
DanielEScherzer
3f03f7ed3d [RFC] Add support for attributes on compile-time constants
https://wiki.php.net/rfc/attributes-on-constants
2025-04-29 11:53:09 -07:00
Ilija Tovilo
16c4c066f4 Make empty_fcall_info and empty_fcall_info_cache macros
See https://github.com/php/php-src/pull/18273, a constant may cause
unnecessary cache misses.

Closes GH-18326
2025-04-15 12:51:10 +02:00
Gina Peter Banyard
b4f275f9f8 Zend: Use ZEND_FCI_INITIALIZED() macro to check if an FCI is initialized (#17291) 2025-01-31 12:10:44 +00:00
Eric Norris
0a14ab18d2 RFC: Error Backtraces v2 (#17056)
see https://wiki.php.net/rfc/error_backtraces_v2

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-01-29 12:54:23 +01:00
Niels Dossche
afc1f0d99b Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17216: Trampoline crash on error
2024-12-21 00:26:37 +01:00
Niels Dossche
627432785e Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17216: Trampoline crash on error
2024-12-21 00:26:23 +01:00
Niels Dossche
2c3b56ded0 Fix GH-17216: Trampoline crash on error
The error handling is incomplete on argument cleanup.
1. The fci is not cleared which means that zend_free_trampoline() is
   never called.
2. The cleaning for extra named arguments was missing, resulting in
   memory leak.

Closes GH-17219.
2024-12-21 00:25:06 +01:00
Daniel Scherzer
f5e743a520 Add ReflectionConstant::getFileName()
Allow determining the name of the file that defined a constant, when the
constant was defined in userland code via const or define(). For constants
defined by PHP core or extensions, false is returned, matching the existing
getFileName() methods on other reflection classes.

Fixes GH-15723
Closes GH-15847
2024-10-31 16:47:45 +01:00
DanielEScherzer
ea297654f4 Zend/*: fix a bunch of typos (GH-16017)
* Zend/*: fix a bunch of typos

* Zend/tests/try/try_catch_finally_005.phpt: update string length
2024-09-24 10:55:21 +02:00
Arnaud Le Blanc
58aa6fc830 Lazy objects
RFC: https://wiki.php.net/rfc/lazy-objects

Closes GH-15019
2024-08-30 17:30:03 +02:00
Ilija Tovilo
780a8280d2 [RFC] Property hooks (#13455)
RFC: https://wiki.php.net/rfc/property-hooks

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2024-07-14 11:55:03 +02:00
Peter Kokot
c3388c1841 Sync #if/ifdef/defined (#14512)
These are either undefined or defined to 1:
- HAVE_LIBEDIT
- HAVE_LIBREADLINE
- ZEND_MAX_EXECUTION_TIMERS

Follow up of GH-5526 (-Wundef)
2024-06-10 08:56:10 +02:00
Arnaud Le Blanc
7c5d6557e1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Use ITIMER_REAL for timeout handling on MacOS / Apple Silicon system
2024-05-28 15:27:32 +02:00
Arnaud Le Blanc
3b2764bc76 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use ITIMER_REAL for timeout handling on MacOS / Apple Silicon system
2024-05-28 15:26:53 +02:00
Manuel Kress
272da51bfd Use ITIMER_REAL for timeout handling on MacOS / Apple Silicon system
setitimer(ITIMER_PROF) fires too early on MacOS 14 when running on Apple
Silicon. See https://openradar.appspot.com/radar?id=5583058442911744.

Fixes GH-12814
Closes GH-13567
2024-05-28 15:25:46 +02:00
Ilija Tovilo
8a7d79da90 Merge branch 'PHP-8.3'
* PHP-8.3:
  Temporary reset filename and lineno override before autoload
2024-04-22 10:58:02 +02:00
Ilija Tovilo
5899cabff0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Temporary reset filename and lineno override before autoload
2024-04-22 10:57:47 +02:00
SATO Kentaro
f8b9030b4e Temporary reset filename and lineno override before autoload
Closes GH-10232
Closes GH-13313
2024-04-22 10:56:45 +02:00
Arnaud Le Blanc
af5db45dc9 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  fix: zend-max-execution-timers with negative or high timeout value (#13942)
  Use return value of getpwuid_r(), not errno (#13969)
2024-04-16 14:20:23 +02:00
Arnaud Le Blanc
c12fd0873b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  fix: zend-max-execution-timers with negative or high timeout value (#13942)
  Use return value of getpwuid_r(), not errno (#13969)
2024-04-16 14:19:35 +02:00
Kévin Dunglas
f6e8145b47 fix: zend-max-execution-timers with negative or high timeout value (#13942)
Align the behavior of zend-max-execution-timers with other timeout impls: Negative or very high timeout values are equivalent to no timeout
2024-04-16 14:13:36 +02:00
Ilija Tovilo
6db06a7c0f Fix class name in warning of frameless calls (#13619) 2024-03-07 20:11:27 +01:00
Ilija Tovilo
631bc81607 Implement stackless internal function calls
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12461
2024-02-06 17:42:28 +01:00
Ilija Tovilo
692cea5cbc Use zend_error_noreturn for E_ERROR consistently
To be clear, these already don't return. zend_error_noreturn just hints at this
fact through the ZEND_NORETURN attribute.

Closes GH-12204
2023-09-14 11:44:55 +02:00
Ilija Tovilo
ae431bbfeb Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix use-of-uninitialized-value in start_fake_frame
2023-08-03 09:50:32 +02:00
Ilija Tovilo
4db025bd86 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix use-of-uninitialized-value in start_fake_frame
2023-08-03 09:50:20 +02:00
Ilija Tovilo
ed27d70d9a Fix use-of-uninitialized-value in start_fake_frame
Closes GH-11732
2023-08-03 09:49:51 +02:00
Ilija Tovilo
1a0ef2c1cc Revert "Remove name field from the zend_constant struct (#10954)"
This reverts commit f42992f580.

Closes GH-11604
2023-07-17 22:32:41 +02:00