Commit graph

2021 commits

Author SHA1 Message Date
Ilija Tovilo
998bce117c
Show enum cases in errors
Closes GH-14496
2024-06-10 22:58:25 +02:00
Ilija Tovilo
8160869e3d
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix missing handling of CALLABLE_CONVERT in cleanup_unfinished_calls()
2024-04-19 20:06:27 +02:00
Ilija Tovilo
4393198bbd
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix missing handling of CALLABLE_CONVERT in cleanup_unfinished_calls()
2024-04-19 20:06:15 +02:00
Ilija Tovilo
b3e26c3036
Fix missing handling of CALLABLE_CONVERT in cleanup_unfinished_calls()
Fixes GH-14003
2024-04-19 20:04:51 +02:00
Máté Kocsis
f2e199e878
Implement "support doc comments for internal classes and functions" (#13266)
Fixes #13130
2024-02-25 08:41:31 +01:00
Michael Voříšek
87edeed3b9
Remove UNEXPECTED from typed prop checks
Closes GH-13143
2024-02-12 11:35:43 +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
Niels Dossche
fe064d7f12 Fix GH-13142: Undefined variable name is shortened when contains \0
Uses the new %S formatter and introduces the necessary changes and
helpers.
2024-01-20 23:49:13 +01:00
Ilija Tovilo
ffc250d245
Add runtime type inference verification
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12930
2024-01-19 09:29:14 +01:00
Máté Kocsis
d84ed03a68 Improve error messages related to void/never return types of methods 2024-01-14 16:04:23 +01:00
Arnaud Le Blanc
3c3aba11be Merge branch 'PHP-8.3'
* PHP-8.3:
  WS
  Clarify the stack limit exception message
  Fix GH-12643: Stack limit tests failing on ppc64le
2023-12-10 13:27:13 +01:00
Arnaud Le Blanc
6aa70b577d WS 2023-12-10 13:24:49 +01:00
Arnaud Le Blanc
b1516d95e0 Clarify the stack limit exception message
Make it clearer why the size is not exactly zend.max_allowed_stack_size
2023-12-10 13:20:21 +01:00
Dmitry Stogov
25de668621 Merge branch 'PHP-8.3'
* PHP-8.3:
  Align error messages between normal VM and JIT for RW when using object as array (#12799)
2023-11-28 00:40:57 +03:00
Dmitry Stogov
f4b473ca71 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Align error messages between normal VM and JIT for RW when using object as array (#12799)
2023-11-28 00:40:48 +03:00
Gina Peter Banyard
e94ab0461c
Align error messages between normal VM and JIT for RW when using object as array (#12799) 2023-11-28 00:37:21 +03: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
David CARLIER
2778b5d25f
zend vm savee registers support for riscv 64. (#11773)
x8 being already reserved, we can only pull x18 to x27.
2023-07-24 08:25:45 +01:00
Máté Kocsis
c322da0606
Fix misleading pass by reference error message (#10639) 2023-07-18 15:02:38 +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
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
George Peter Banyard
99fa740acb
Use common function for TypeError on illegal offset access (#10544)
This merges all usages of emitting an offset TypeError into a new ZEND_API function
zend_illegal_container_offset(const zend_string* container, const zval *offset, int type);

Where the container should represent the type on which the access is attempted (e.g. string, array)
The offset zval that is used, where the error message will display its type
The type of access, which should be a BP_VAR_* constant, to get special message for isset/empty/unset
2023-06-06 11:28:19 +01:00
Ilija Tovilo
ded8b7f5bd
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix access on NULL pointer in array_merge_recursive()
2023-05-24 13:37:59 +02:00
Ilija Tovilo
4676d9bc43
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix access on NULL pointer in array_merge_recursive()
2023-05-24 13:37:47 +02:00
Ilija Tovilo
f5c54fd88b
Fix access on NULL pointer in array_merge_recursive()
Closes GH-11303
2023-05-24 13:36:52 +02:00
Máté Kocsis
414f71a902
Typed class constants (#10444)
RFC: https://wiki.php.net/rfc/typed_class_constants

Co-Authored-By: Ben <7127204+moliata@users.noreply.github.com>
Co-Authored-By: Bob Weinand <3154871+bwoebi@users.noreply.github.com>
Co-Authored-By: Ilija Tovilo <ilija.tovilo@me.com>
2023-04-16 22:20:26 +02:00
Dmitry Stogov
0660fb5282 Merge branch 'PHP-8.2'
* PHP-8.2:
  Allow FETCH_OBJ_W and FETCH_STATIC_PROP_W to return INDIRECT/UNDEF zval for uninitialized typed properties (#11048)
2023-04-10 23:25:42 +03:00
Dmitry Stogov
e14ac1caee Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Allow FETCH_OBJ_W and FETCH_STATIC_PROP_W to return INDIRECT/UNDEF zval for uninitialized typed properties (#11048)
2023-04-10 23:25:08 +03:00
Dmitry Stogov
0c65b396d6
Allow FETCH_OBJ_W and FETCH_STATIC_PROP_W to return INDIRECT/UNDEF zval for uninitialized typed properties (#11048) 2023-04-10 23:19:17 +03:00
Ilija Tovilo
fdbea4f39e
Add GC_DTOR/GC_DTOR_NO_REF macros 2023-04-04 18:55:47 +02:00
Ilija Tovilo
b39107c774
Delay destructor for zend_assign_to_typed_ref 2023-04-04 18:55:47 +02:00
Dmitry Stogov
915b2837f7
Delay freeing of overwritten values in assignments
Fixes GH-10168
2023-04-04 18:55:46 +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
Niels Dossche
6a6e91f3c7
Shrink some commonly used structs by reordering members (#10880)
Struct members require some alignment based on their type. This means
that if a struct member is not aligned, there will be a hole created by
the compiler in the struct, which is wasted space. This patch reorders
some of the most commonly used structs, but in such a way that the
fields which were in the same cache line still belong together.
The only exception to this is exception_ignore_args, which was
temporally not close to nearby members, and as such I placed
it further up to close a hole.

On 64-bit Linux this gives us the following shrinks:
* zend_op_array: 248 -> 240
* zend_ssa_var: 56 -> 48
* zend_ssa_var_info: 48 -> 40
* php_core_globals: 672 -> 608
* zend_executor_globals: 1824 -> 1792

On 32-bit, the sizes will either remain the same or will result in
smaller shrinks.
2023-03-22 19:26:42 +01:00
Máté Kocsis
3deba4c2e8
Update assertion about unsupported property types 2023-03-21 11:53:40 +01:00
Máté Kocsis
e053ba0a3a
Do not allow side-effects when readonly property modification fails (#10757) 2023-03-03 19:53:42 +01:00
Máté Kocsis
3bcf2c3755
Allow readonly properties to be reinitialized once during cloning (#10389)
RFC: https://wiki.php.net/rfc/readonly_amendments
2023-02-28 22:54:38 +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
d5c649b36b
zend_compiler, ...: use uint8_t instead of zend_uchar (#10621)
`zend_uchar` suggests that the value is an ASCII character, but here,
it's about very small integers.  This is misleading, so let's use a
C99 integer instead.

On all architectures currently supported by PHP, `zend_uchar` and
`uint8_t` are identical.  This change is only about code readability.
2023-02-23 14:56:54 +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
Ilija Tovilo
a3e44bbb9d
Merge branch 'PHP-8.2'
* PHP-8.2:
  Revert "Fix GH-10168: heap-buffer-overflow at zval_undefined_cv"
2023-02-16 14:18:24 +01:00
Ilija Tovilo
efb9181a98
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Fix GH-10168: heap-buffer-overflow at zval_undefined_cv"
2023-02-16 14:13:17 +01:00
Ilija Tovilo
7b68ff46da
Revert "Fix GH-10168: heap-buffer-overflow at zval_undefined_cv"
This reverts commit 71ddede565.
2023-02-16 14:07:17 +01:00
Bob Weinand
e8d16fda13 Merge branch 'PHP-8.2' 2023-02-13 13:10:44 +01:00
Bob Weinand
0e31e03bc5 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-13 13:10:08 +01:00
Arnaud Le Blanc
d721dcc2ef Fix colletion of unfinished function call in fibers
Fixes GH-10496.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2023-02-13 13:09:04 +01:00
Marcos Marcolin
641fe23e3a
Improve illegal offset error messages (#10504)
Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>
2023-02-08 12:11:41 +00:00
Ilija Tovilo
e3179a0955
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10168: heap-buffer-overflow at zval_undefined_cv
2023-02-08 01:21:28 +01:00
Ilija Tovilo
972a5a02bd
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10168: heap-buffer-overflow at zval_undefined_cv
2023-02-08 01:12:03 +01:00