Commit Graph

1101 Commits

Author SHA1 Message Date
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
Ilija Tovilo
11aee73572
Fix incorrect handling of unwind and graceful exit exceptions
These exceptions should not invoke the user error handler, and not cause bailing
of the request.

Fixes GH-11601
Closes GH-11608
2023-07-07 08:15:17 +02:00
Ilija Tovilo
ad1b70d67e
Revert "Revert "Remove name field from the zend_constant struct (#10954)""
This reverts commit 9f4bd3040d.
2023-07-04 16:42:40 +02:00
Máté Kocsis
9f4bd3040d
Revert "Remove name field from the zend_constant struct (#10954)"
This reverts commit f42992f580.

Fix GH-11423
2023-07-03 15:16:24 +02:00
Ilija Tovilo
b3e33be443
Forward shutdown exceptions to user error handlers
Fixes GH-10695
Closes GH-110905
2023-06-15 17:11:22 +02:00
Máté Kocsis
f42992f580
Remove name field from the zend_constant struct (#10954)
As global constant names are case-sensitive now, we don't have to store them separately above the constant table.
2023-04-03 22:13:47 +02:00
Ilija Tovilo
9d5f2f1343
Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Ilija Tovilo
9944f58d3f
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10709: UAF in recursive AST evaluation
2023-03-06 15:03:19 +01:00
Ilija Tovilo
1978a7b393
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10709: UAF in recursive AST evaluation
2023-03-06 14:58:25 +01:00
Ilija Tovilo
7202fe16b7
Fix GH-10709: UAF in recursive AST evaluation
Fixes https://oss-fuzz.com/testcase-detail/6445949468934144
Closes GH-10718
2023-03-06 14:55:34 +01:00
Arnaud Le Blanc
0c7fc351ea Merge branch 'PHP-8.2'
* PHP-8.2:
  [ci skip] NEWS
  [ci skip] NEWS
  fix: support for timeouts with ZTS on Linux (#10141)
2023-03-03 11:56:34 +01:00
Arnaud Le Blanc
37030257b8 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  fix: support for timeouts with ZTS on Linux (#10141)
2023-03-03 11:45:50 +01:00
Kévin Dunglas
ad85e71421
fix: support for timeouts with ZTS on Linux (#10141) 2023-03-03 11:35:06 +01:00
Niels Dossche
9108a32bfe
Minor cleanups in Zend execution APIs (#10699)
* Remove always-false check in zend_lookup_class_ex()

This check is always false because of the undefined behaviour rule that
says a NULL pointer must never be dereferenced: we already dereference name
when checking the cache slot, before the NULL check. So the NULL may be
optimised away by the compiler. It looks like the code isn't even
supposed to work with name being NULL, so just remove the check.

* Remove always-true check in zend_fetch_static_property_address_ex()

* Simplify always-true conditions
2023-02-26 14:15:04 +00:00
Max Kellermann
413844d626
Zend/zend_types.h: deprecate zend_bool, zend_intptr_t, zend_uintptr_t (#10597)
These types are standard C99.

For compatibility with out-of-tree extensions, keep the typedefs
in main/php.h.
2023-02-18 19:31:28 +00:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
Max Kellermann
ecc880f491 Zend/zend_execute: include cleanup 2023-01-10 14:19:03 +00:00
Arnaud Le Blanc
a11c8a3039
Limit stack size (#9104) 2022-12-16 17:44:26 +01:00
Christoph M. Becker
6109b80926
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fallback to first line of function when ex->opline is NULL (#10003)
2022-12-05 12:45:49 +01:00
Christoph M. Becker
b683a7e470
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fallback to first line of function when ex->opline is NULL (#10003)
2022-12-05 12:45:22 +01:00
Arnaud Le Blanc
adc23828b4
Fallback to first line of function when ex->opline is NULL (#10003)
ex->opline can be null due to missing SAVE_OPLINE() in the VM

Fixes GH-9933
2022-12-02 17:21:30 +01:00
Ilija Tovilo
683d81e4bd
Fix incorrect short-circuiting in constant expressions (#10030)
Fixes GH-10014
2022-12-01 19:30:44 +01:00
Ilija Tovilo
8731fb2d09
Fix caching of default params with side-effects
Fixes GH-9965
Closes GH-9935
2022-11-17 11:52:12 +01:00
Ilija Tovilo
a9231e7fb2
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix fake closure leaking when called from internal func
2022-11-03 14:32:22 +01:00
Ilija Tovilo
cc9dddea38
Fix fake closure leaking when called from internal func
Introduced in 8e49d7f32f.

ZEND_CALL_RELEASE_THIS was previously not handled for internal calls but
just for user calls in the zend_leave_helper.

Closes GH-9884
2022-11-03 14:31:47 +01:00
George Peter Banyard
7c45b95894 Store a reference to closures in the FCC 2022-11-02 14:52:54 +00:00
Ilija Tovilo
51a99456e2
Merge branch 'PHP-8.2'
* PHP-8.2:
  Remove unnecessary ast eval bailout
2022-10-27 10:56:04 +02:00
Ilija Tovilo
1d6b32f65c
Remove unnecessary ast eval bailout
We can just reset the filename_override to NULL in php_request_shutdown.

Closes GH-9805
2022-10-27 10:54:59 +02:00
Kévin Dunglas
9da75d0c63
fix: no-op when signal handlers are called on threads not managed by PHP (#9766) 2022-10-22 11:17:27 +02:00
Kévin Dunglas
e6bfd7e089 Set SA_ONSTACK too when zend signals are disabled and in pcntl
Closes GH-9758.
2022-10-16 23:47:53 +01:00
Jakub Zelenka
505e8d2a04
Fix GH-9310: SSL local_cert and local_pk do not respect open_basedir restriction 2022-08-28 12:11:14 +01:00
Bob Weinand
625f164963 Include internal functions in the observer API
There are two main motivations to this:
a) The logic for handling internal and userland observation can be unified.
b) Unwinding of observed functions on a bailout does notably not include observers. Even if users of observers were to ensure such handling themselves, it would be impossible to retain the relative ordering - either the user has to unwind all internal observed frames before the automatic unwinding (zend_observer_fcall_end_all) or afterwards, but not properly interleaved.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-07-30 19:20:55 +02:00
George Peter Banyard
6b160e78a7
Change fetch_type from int to uint32_t (#9152)
This is because it is derived from the opcode num which is an uint32_t
2022-07-28 21:03:09 +01:00
Rowan Tommins
af15923bc3
Extend deprecation notices to is_callable($foo) and callable $foo
Implements https://wiki.php.net/rfc/partially-supported-callables-expand-deprecation-notices
so that uses of "self" and "parent" in is_callable() and callable
type constraints now raise a deprecation notice, independent of the
one raised when and if the callable is actually invoked.

A new flag is added to the existing check_flags parameter of
zend_is_callable / zend_is_callable_ex, for use in internal calls
that would otherwise repeat the notice multiple times. In particular,
arguments to internal function calls are checked first based on
arginfo, and then again during ZPP, so the former suppresses the
deprecation notice.

Some existing tests which raised this deprecation have been updated
to avoid the syntax, but the existing version retained for maximum
regression coverage until it is made an error.

With thanks to Juliette Reinders Folmer for the RFC and initial
investigation.

Closes GH-8823.
2022-07-14 17:07:42 +02:00
Ilija Tovilo
d9e1871c85 Fix leak of backed_enum_table with preloading 2022-06-23 19:17:44 +02:00
Levi Morrison
280fd680c8
Make vm_interrupt and timed_out atomic (#8327)
This is done by adding a new zend_atomic_bool type. The type
definition is only available for compiler alignment and size info; it
should be treated as opaque and only the zend_atomic_bool_* family of
functions should be used.

Note that directly using atomic_bool is complicated. All C++ compilers
stdlibs that I checked typedef atomic_bool to std::atomic<bool>, which
can't be used in an extern "C" section, and there's at least one usage
of this in core, and probably more outside of it.

So, instead use platform specific functions, preferring compiler
intrinsics.
2022-06-01 09:43:25 -06:00
Sara Golemon
6c0a1db4a8 Merge branch 'PHP-8.1'
* PHP-8.1:
  Verify internal types before abandoning call frame
2022-06-01 00:52:30 +00:00
Sara Golemon
01d84545e7
Verify internal types before abandoning call frame
An internal caller executing a builtin method with
a static return type will lose context if we drop
our frame before performing the validation.
2022-06-01 00:51:08 +00:00
Máté Kocsis
da857c94a4
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix get_function_or_method_name when included file is scoped
2022-05-03 21:38:32 +02:00
Máté Kocsis
510061b595
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix get_function_or_method_name when included file is scoped
2022-05-03 21:36:42 +02:00
vajexal
74924ada93
Fix get_function_or_method_name when included file is scoped (#8467) 2022-05-03 21:34:01 +02:00
Max Kellermann
b9e895bca0
Replace memcmp() with zend_string functions (#8216)
* ext/oci8: use zend_string_equals()

Eliminate duplicate code.

* main/php_variables: use zend_string_equals_literal()

Eliminate duplicate code.

* Zend/zend_string: add zend_string_equals_cstr()

Allows eliminating duplicate code.

* Zend, ext/{opcache,standard}, main/output: use zend_string_equals_cstr()

Eliminate duplicate code.

* Zend/zend_string: add zend_string_starts_with()

* ext/{opcache,phar,spl,standard}: use zend_string_starts_with()

This adds missing length checks to several callers, e.g. in
cache_script_in_shared_memory().  This is important when the
zend_string is shorter than the string parameter, when memcmp()
happens to check backwards; this can result in an out-of-bounds memory
access.
2022-03-31 16:27:58 +02:00
Ilija Tovilo
e3ef7bbbb8
Adjust filename/lineno for constant expressions
Closes GH-7771
Closes GH-8124
2022-03-09 18:41:04 +01:00
Bob Weinand
c414c5f946 Merge branch 'PHP-8.1' 2022-03-07 18:27:43 +01:00
Bob Weinand
cbbf3502a2 Fix GH-8176: Fix leaking enum values in property initializers 2022-03-07 18:26:46 +01:00
Dmitry Stogov
d56ec0a624 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed bug #81607 (CE_CACHE allocation with concurrent access)
2021-11-17 18:25:00 +03:00