Commit graph

249 commits

Author SHA1 Message Date
Niels Dossche
f4ba3564f5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Correct check for maximum string length in JIT helpers
2025-03-13 23:49:42 +01:00
Niels Dossche
a7d2703246
Correct check for maximum string length in JIT helpers
This is a bit of a theoretical issue, but the maximum string length is
actually ZSTR_MAX_LEN instead of SIZE_MAX. The resulting check is a bit
slower but should still be relatively cheap.

Closes GH-18049.
2025-03-13 23:47:45 +01:00
Dmitry Stogov
cfd954f5f9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16499: [JIT] Undefined to null coercion issues for return
2024-10-21 14:51:41 +03:00
Dmitry Stogov
920e3d6b70
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16499: [JIT] Undefined to null coercion issues for return
2024-10-21 14:51:31 +03:00
Dmitry Stogov
fe513655dc
Fix GH-16499: [JIT] Undefined to null coercion issues for return 2024-10-21 14:50:50 +03:00
Arnaud Le Blanc
c65e042c0b
Fix zend_get_property_info_for_slot() for lazy objects (#15855)
zend_get_property_info_for_slot(obj, slot) assumes that 'slot' belongs to 'obj', but that may not be the case for lazy proxies.

Fortunately, the property info is often already available in path when it is needed.

For other cases, I make zend_get_property_info_for_slot() aware of lazy objects, and add zend_get_property_info_for_slot_self() for cases where the 'slot' is known to belong to the object itself.

Fixes oss-fuzz #71446
2024-09-16 16:58:12 +02:00
Ilija Tovilo
8df557ac42
[RFC] Asymmetric visibility v2 (GH-15063)
Co-authored-by: Larry Garfield <larry@garfieldtech.com>
2024-08-27 02:04:48 +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
Niels Dossche
7407e760f1 Remove duplicated code
The exact same code already exists above this.
2024-07-02 02:51:18 -07:00
Niels Dossche
985e5ffdb0 Remove doubled variable name from assignment 2024-07-02 02:51:18 -07:00
Dmitry Stogov
13d5c812e0
JIT: Add CPU registers support for FETCH_OBJ_R (#14253) 2024-05-19 22:18:30 +03: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
Cristian Rodríguez
927adfb1a6
Use a single version of mempcpy(3) (#12257)
While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_mempcpy, adds zend_mempcpy and transforms
open-coded parts into function calls.
2023-12-20 15:16:32 +00:00
Gina Peter Banyard
c70219e4aa
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown
2023-11-27 16:20:44 +00:00
Gina Peter Banyard
126a255d66
jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown 2023-11-27 16:19:35 +00:00
Gina Peter Banyard
52463ae233
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  jit: fixed "Uninitialized string offset" warning being emitted at the same time as invalid offset Error
2023-11-27 16:06:15 +00:00
Gina Peter Banyard
ed8b901869
jit: fixed "Uninitialized string offset" warning being emitted at the same time as invalid offset Error 2023-11-27 16:04:41 +00:00
Dmitry Stogov
6f355c6c79 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error
2023-11-22 13:26:07 +03:00
Dmitry Stogov
2d65d714a3 Fixed GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error 2023-11-22 13:19:10 +03:00
Dmitry Stogov
f48ab6a66f Fixed GH-12747: Function JIT returns invalid error message for coalesce operator on invalid offset 2023-11-22 13:01:35 +03:00
Dmitry Stogov
d2cf3a45b5 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-12428: Assertion with function/tracing JIT
2023-10-16 15:12:38 +03:00
Dmitry Stogov
0c6999cf94 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-12428: Assertion with function/tracing JIT
2023-10-16 15:12:29 +03:00
Dmitry Stogov
dabced0fbb Fixed GH-12428: Assertion with function/tracing JIT 2023-10-16 15:11:56 +03: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
Dmitry Stogov
e1c6fb76c0
JIT support for delayed destructor for zend_assign_to_typed_ref/prop 2023-04-04 18:55:47 +02:00
Dmitry Stogov
24acb4f134
Delay destructor for zend_std_write_property 2023-04-04 18:55:47 +02:00
George Peter Banyard
d7c351ea54
Propagate UTF-8 flag during Rope operations (#10915) 2023-03-26 14:18:46 +01:00
Ilija Tovilo
3f7dadfeca
Fix readonly+clone JIT issues
Closes GH-10748
2023-03-07 13:20:52 +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
Ilija Tovilo
86669774ae
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix missing readonly modification error with inc/dec in JIT
2023-03-02 11:31:42 +01:00
Ilija Tovilo
7934a0fcfb
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix missing readonly modification error with inc/dec in JIT
2023-03-02 11:31:29 +01:00
Ilija Tovilo
df93146a15
Fix missing readonly modification error with inc/dec in JIT
Closes GH-10746
2023-03-02 11:29:53 +01: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
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
Niels Dossche
99b86141ae Introduce convenience macros for copying flags that hold when concatenating two strings
This abstracts away, and cleans up, the flag handling for properties of
strings that hold when concatenating two strings if they both hold that
property. (These macros also work with simply copies of strings because
a copy of a string can be considered a concatenation with the empty
string.) This gets rid of some branches and some repetitive code, and
leaves room for adding more flags like these in the future.
2023-02-05 14:32:50 +00:00
George Peter Banyard
64127b66c6 Concatenating two valid UTF-8 strings produces a valid UTF-8 string
The UTF-8 valid flag needs to be copied upon interning,
otherwise strings that are concatenated at compile time lose this information.

However, if previously this string was interned without the flag it is not added
E.g. in the case the string is an existing class name.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2023-02-02 12:02:36 +00:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Arnaud Le Blanc
a11c8a3039
Limit stack size (#9104) 2022-12-16 17:44:26 +01:00
Ilija Tovilo
6e5b989886
Remove unused PHP 8.1 BC layer in JIT (#9937) 2022-11-11 20:03:53 +01:00
Dmitry Stogov
7e23c838e2 Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT 2022-06-27 16:41:53 +03:00
Dmitry Stogov
ad40fffd36 Fixed Bug GH-8863: RW operation on readonly property doesn't throw with JIT 2022-06-27 14:25:30 +03:00
Dmitry Stogov
3e128eecaa Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fix incorrect reference-counting
2022-06-14 15:04:55 +03:00
Dmitry Stogov
971b07ea60 JIT: Fix incorrect reference-counting
This fixes oss-fuzz #47937
2022-06-14 15:03:50 +03:00
George Peter Banyard
b40ae80804
Convert iterable into an internal alias for Traversable|array (#7309)
This does a compile time transformation of ``iterable`` into ``Traversable|array`` which simplifies some of the LSP variance handling.

The arginfo generation script from stubs is updated to produce a union type when it encounters the type ``iterable``
Extension functions which do not regenerate the arginfo, or write them manually are still supported by mimicking the compile time transformation while registering the function.

Type Reflection is preserved for single ``iterable`` (and ``?iterable``) to produce a ReflectionNamedType with name ``iterable``, however usage of ``iterable`` in union types will be converted to ``array|Traversable``
2022-06-07 13:35:34 +01:00
Dmitry Stogov
2d3415a74a Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fixed memory leak
2022-03-25 16:56:08 +03:00
Dmitry Stogov
7aac1c11ee Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed memory leak
2022-03-25 16:55:37 +03:00
Dmitry Stogov
aa352c2c54 JIT: Fixed memory leak
Fixes oss-fuzz #45981
2022-03-25 16:54:50 +03:00