Commit Graph

17810 Commits

Author SHA1 Message Date
Dmitry Stogov
21507ef28a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix SSA reconstruction when body of "foreach" loop is removed
2022-08-01 14:01:34 +03:00
Dmitry Stogov
4b19b85eb6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix SSA reconstruction when body of "foreach" loop is removed
2022-08-01 14:01:11 +03:00
David Carlier
449edd815b phpdbg few fixes, mostly printf-like format issues due to C str -> zend_string mismatches. annotate the allocator wrapper.
Closes #9210.
2022-07-31 19:07:37 +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
Bob Weinand
9e2de4c2d9 Add an API to manipulate observers at runtime
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-07-29 13:48:05 +02:00
Ilija Tovilo
f957e3e7f1
Fix arrow function with never return type
Fixes GH-7900
Closes GH-9103
2022-07-29 12:25:09 +02:00
Nikita Popov
107ad28350 Suppress unused-but-set-variable warning in parsers
This is very ugly: Bison provides a yynerrs variable, which is
usually not actually used, but also not annotated with
YY_MAYBE_UNUSED. Suppress this warning by adding a (void)yynerrs
into the top-level reduction action. The alternative would be to
disable the warning for these generated files.
2022-07-28 22:29:42 +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
Ilija Tovilo
966d22b1bd
Fix property fetch on magic constants in constant expressions
Closes GH-9136
Closes GH-9138
Closes GH-9172
2022-07-28 14:14:11 +02:00
Bob Weinand
b576bb901e Avoid using a stack allocated zend_function in Closure::call, to avoid prevent crashes on bailout
Having a stack allocated zend_function may cause crashes if the stack is polluted between bailout and the actual unwinding in zend_observer_fcall_end_all.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-07-28 13:04:11 +02:00
George Peter Banyard
9115211ebf
Use uint32_t in Z_PARAM_VARIADIC_WITH_NAMED 2022-07-26 11:55:26 +01:00
George Peter Banyard
bdf5a4e478
The hashvalue/index of a bucket is a zend_ulong 2022-07-26 11:54:33 +01:00
Dmitry Stogov
87cf05e8be Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-07-25 15:55:15 +03:00
Dmitry Stogov
d50875c822 Fix type inference
Fixes oss-fuzz #49423 and #49474
2022-07-25 15:53:06 +03:00
David Carlier
53ae24e435 zend defines attribute malloc for Win32 as returned pointer are not aliased
Closes #9118.
2022-07-25 13:43:41 +01:00
Martin Schröder
0adbf9c2d4
Fix memory leak in fiber constructor by throwing an error (#9098) 2022-07-22 10:47:47 -05:00
George Peter Banyard
4457dba1fb
Add support for stubs to declare intersection type class properties (#8751) 2022-07-22 13:04:49 +01:00
Ilija Tovilo
41a5b46e7d
Fix RC debug of stub attribute (#9082) 2022-07-21 15:06:04 +02:00
Ilija Tovilo
d4a9cc8856
Fix rc info of iterator_to_array (#9080)
This function can now return a copy of the provided array, resulting in
a value of RC != 1.
2022-07-21 15:05:34 +02:00
Patrick Allaert
9af3327176
PHP-8.1 is now for PHP 8.1.10-dev 2022-07-20 06:48:52 +02:00
Máté Kocsis
e328c68305
Rename @cname to @cvalue in stubs (#9043)
@cname currently refers to the constant name in C. However, it is not always a (constant) name, but sometimes a function invocation, so naming it as @cvalue would be more appropriate.
2022-07-19 15:11:42 +02:00
dixyes
180557dd9c
Do not assert SSE/AVX resolvers at windows arm64
NEWS/UPGRADING are already handled by 745cf34ffc.

Closes GH-7704.
2022-07-19 14:04:51 +02:00
Go Kudo
4d8dd8d258
Implement Random Extension
https://wiki.php.net/rfc/rng_extension
https://wiki.php.net/rfc/random_extension_improvement
2022-07-19 10:27:38 +01:00
Ilija Tovilo
7aadbcb8f4
GH-8344 Fetch properties of enums in const expressions 2022-07-18 23:52:28 +02:00
Dmitry Stogov
71814e9d99 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-07-18 14:20:41 +03:00
Dmitry Stogov
82d3ad64df Fix type inference
Fixes oss-fuzz #48908
2022-07-18 14:20:06 +03:00
Dmitry Stogov
26d890e6ba Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference for FETCH_DI_UNSET
2022-07-18 13:15:12 +03:00
Dmitry Stogov
b734d45626 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference for FETCH_DI_UNSET
2022-07-18 13:15:03 +03:00
Remi Collet
55a88f36b6
add SensitiveParameter as known string and use it in arginfo 2022-07-18 11:43:33 +02:00
Aaron Piotrowski
2bc6025c2c
Prevent fiber switching in tick function and signal handlers (#9028) 2022-07-16 13:05:16 -05:00
Arnaud Le Blanc
4552941219 Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] NEWS
  Fix `WeakMap` object reference offset causing `TypeError` (#8995)
2022-07-15 13:19:12 +02:00
Arnaud Le Blanc
aadb24e817 Merge branch 'PHP-8.0' into PHP-8.1 2022-07-15 13:15:05 +02:00
Tobias Bachert
ede92a86f2
Fix WeakMap object reference offset causing TypeError (#8995) 2022-07-15 13:00:48 +02:00
Ilija Tovilo
63912b5ecd
Fix RC func info of str_split (#9016)
Introduced in GH-8945

With RETURN_EMPTY_ARRAY this function can now return an interned array which
has refcount 2.
2022-07-15 11:23:55 +02: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
Ayesh Karunaratne
9f8e5182a1
INI parser: Fix typo /multipler/multiplier
Closes GH-8987.
2022-07-13 12:16:26 +02:00
Tim Düsterhus
342e18f105
Support the actual #[\SensitiveParameter] attribute in stubs (#8836) 2022-07-12 12:43:44 +02:00
Máté Kocsis
bb5be650c6
Require zend_constants.stub.php from zend_exceptions.stubs.php
Because E_ERROR is referenced in this file
2022-07-12 10:35:03 +02:00
Tim Düsterhus
75a9a5f311
Add zend_array_to_list() (#8976)
* Add zend_array_to_list()

* Use `zend_array_to_list()` in `PHP_FUNCTION(array_values)`
2022-07-11 15:29:40 +02:00
Arnaud Le Blanc
4df3dd7679
Reduce memory allocated by var_export, json_encode, serialize, and other (#8902)
smart_str uses an over-allocated string to optimize for append operations. Functions that use smart_str tend to return the over-allocated string directly. This results in unnecessary memory usage, especially for small strings.

The overhead can be up to 231 bytes for strings smaller than that, and 4095 for other strings. This can be avoided for strings smaller than `4096 - zend_string header size - 1` by reallocating the string.

This change introduces `smart_str_trim_to_size()`, and calls it in `smart_str_extract()`. Functions that use `smart_str` are updated to use `smart_str_extract()`.

Fixes GH-8896
2022-07-08 14:47:46 +02:00
George Peter Banyard
f905590764
Add support for Disjoint Normal Form (DNF) types (#8725)
RFC: https://wiki.php.net/rfc/dnf_types

This allows to combine union and intersection types together in the following form (A&B)|(X&Y)|T but not of the form (X|A)&(Y|B) or (X|A)&(Y|B)|T.

* Improve union type parsing

Co-authored-by: Sara Golemon <pollita@php.net>
2022-07-08 11:30:23 +01:00
Bob Weinand
9f29e2d7e9 Allow for arbitrary (class) attributes in stubs
This can be easily extended to other types of attributes.

Closes #8839.
2022-07-05 18:23:05 +02:00
David Carlier
dfbb425295 Use safe_*erealloc* flavor in few places to mitigate possible overflows. 2022-07-04 14:41:04 +01:00
Ilija Tovilo
40908b10fc
Merge branch 'PHP-8.1'
* PHP-8.1:
  Disallow assigning reference to  unset readonly property
2022-07-01 12:20:32 +02:00
Ilija Tovilo
110573726b
Disallow assigning reference to unset readonly property
Closes GH-7942
Closes GH-8188
2022-07-01 12:16:32 +02:00
Michael Voříšek
f26f6d9479
Add test for backtrace with aliased trait (#8705) 2022-06-30 19:59:33 +02:00
twosee
b09420e3a8
Fix zend_atomic_bool_exchange_ex() in HAVE_NO_ATOMICS case (#8801) 2022-06-30 11:54:47 +08:00
Ilija Tovilo
3b92a96610
Convert return type of various object handlers from int to zend_result (#8755) 2022-06-26 01:00:19 +02:00
Ilija Tovilo
76fcd70c13
Fix enum preloading again (#8859) 2022-06-25 14:55:46 +02:00
Ilija Tovilo
bc03deec27 Fix magic constants in backed enum values
Fix GH-8777
2022-06-23 19:17:44 +02:00