Commit graph

249 commits

Author SHA1 Message Date
Dmitry Stogov
6e1fe96962 JIT: Fix uninitialized result of ASSIGN_DIM[_OP] after clobbering array by user error handler
Fixes oss-fuzz #41208
2021-11-30 11:40:18 +03:00
Dmitry Stogov
11b2cfff5b Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fixed memory leak in Zend/tests/concat_002.phpt introduced by fac78ee760
2021-11-17 18:44:55 +03:00
Dmitry Stogov
8965d6b2ab Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed memory leak in Zend/tests/concat_002.phpt introduced by fac78ee760
2021-11-17 18:44:34 +03:00
Dmitry Stogov
9dd3e8be8a JIT: Fixed memory leak in Zend/tests/concat_002.phpt introduced by fac78ee760 2021-11-17 18:43:39 +03:00
Dmitry Stogov
a9db6e7e4a Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fixed memory leak
2021-11-17 14:02:17 +03:00
Dmitry Stogov
61b432ca24 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed memory leak
2021-11-17 14:02:01 +03:00
Dmitry Stogov
fac78ee760 JIT: Fixed memory leak 2021-11-17 13:59:35 +03:00
Dmitry Stogov
e96f980fcc Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Partially fix handling of exceptions thrown in interrupt handlers
2021-11-11 21:22:54 +03:00
Dmitry Stogov
efba3b6cac Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Partially fix handling of exceptions thrown in interrupt handlers
2021-11-11 21:22:47 +03:00
Dmitry Stogov
5380b415a2 JIT: Partially fix handling of exceptions thrown in interrupt handlers 2021-11-11 21:14:17 +03:00
Dmitry Stogov
f823999d49 Merge branch 'PHP-8.1'
* PHP-8.1:
  Don't call _zend_hash_index_find() for packed arrays
2021-11-08 13:14:11 +03:00
Dmitry Stogov
03f149799a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't call _zend_hash_index_find() for packed arrays
2021-11-08 13:13:48 +03:00
Dmitry Stogov
e868ded6ef Don't call _zend_hash_index_find() for packed arrays 2021-11-08 13:13:23 +03:00
Dmitry Stogov
3602ed0460 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fixed numeric string index handling
2021-11-01 18:52:58 +03:00
Dmitry Stogov
8262329924 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed numeric string index handling
2021-11-01 18:52:50 +03:00
Dmitry Stogov
f1e6a7d83d JIT: Fixed numeric string index handling 2021-11-01 18:50:32 +03:00
Dmitry Stogov
ddaf64b56c Avoid non-immutable map_ptr indirection 2021-10-14 12:16:18 +03:00
Nikita Popov
d5e4f8ffe8 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Handle undefined dim in assign_dim_helper
2021-10-07 15:35:45 +02:00
Nikita Popov
08c29a657d Handle undefined dim in assign_dim_helper
Not only the value can be undefined here, but the offset as well.
2021-10-07 15:35:16 +02:00
Dmitry Stogov
7eab93bcbb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed incorrect reference handling in PRE_INC/DEC_OBJ
2021-10-07 14:34:46 +03:00
Dmitry Stogov
6ab36fb6f9 JIT: Fixed incorrect reference handling in PRE_INC/DEC_OBJ 2021-10-07 14:34:18 +03:00
Nikita Popov
a4fa00ead3 Reuse wrong string offset logic in jit
JIT contains a copy of this function that effectively only differs
by fetching current_execute_data from EG. We can do that in the VM
version as well, as this is just used to throw an error.

Export the VM function and reuse it in JIT.
2021-10-05 16:33:31 +02:00
Dmitry Stogov
214cd1565b Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed result when assigning to typed reference
2021-09-28 14:27:16 +03:00
Dmitry Stogov
17b127a84f JIT: Fixed result when assigning to typed reference 2021-09-28 14:19:23 +03:00
Nikita Popov
b88c678127 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Check exception before using undef_result_after_exception()
2021-09-28 12:22:34 +02:00
Nikita Popov
0391c55b0c Check exception before using undef_result_after_exception()
undefined_op_helper_write() can return 0 not just if an exception
is thrown, so check this explicitly. This fixes an issue introduced
in fe1633f010.
2021-09-28 12:22:12 +02:00
Nikita Popov
fdcacc7015 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Undef result if undef dim warning promoted to exception
2021-09-28 11:36:26 +02:00
Nikita Popov
fe1633f010 Undef result if undef dim warning promoted to exception
Fixes oss-fuzz #39278.
2021-09-28 11:35:53 +02:00
Dmitry Stogov
be8dfa7751 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Split zend_jit_hash_index_lookup_rw() into zend_jit_hash_index_lookup_rw() and zend_jit_hash_index_lookup_rw_no_packed().
2021-09-27 22:14:27 +03:00
Dmitry Stogov
325865d750 JIT: Split zend_jit_hash_index_lookup_rw() into zend_jit_hash_index_lookup_rw() and zend_jit_hash_index_lookup_rw_no_packed().
The previous version might fail if zend_jit_hash_index_lookup_rw() was called for packed array.
2021-09-27 22:09:51 +03:00
Dmitry Stogov
b9f12d628f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed possible memory leak
2021-09-22 22:58:57 +03:00
Dmitry Stogov
09d4037a17 JIT: Fixed possible memory leak 2021-09-22 22:57:57 +03:00
Nikita Popov
560dafb50f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix JIT typed property inc/dec
2021-09-22 15:32:59 +02:00
Nikita Popov
770879702a Fix JIT typed property inc/dec
This was leaking memory for pre-inc/dec of a refcounted typed
property if the result was not used.

The code to do this was unnecessarily complicated, we can base
this on the zend_jit_inc/dec_typed_prop() helper and copy to the
result afterwards.
2021-09-22 15:32:19 +02:00
Nikita Popov
4c31edb44e Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Check for undef var in typed property assignment
2021-09-21 14:11:56 +02:00
Nikita Popov
f4bcf8c393 Check for undef var in typed property assignment
Without this check the assignment would actually silently succeed,
not just skip the warning.
2021-09-21 14:09:26 +02:00
Nikita Popov
ce105f655a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Handle undef assignment to typed ref
2021-09-15 10:58:41 +02:00
Nikita Popov
3ee85ccd4a Handle undef assignment to typed ref 2021-09-15 10:58:01 +02:00
Nikita Popov
9042c7aac6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Handle undef value in assign_dim jit
2021-09-13 11:10:03 +02:00
Nikita Popov
e7663785a7 Handle undef value in assign_dim jit
We should report the undefined variable here and convert it to
null. Passing on undef is particularly insidious here, because
a write_dimension handler may insert it into a hash table
(observed with WeakMap).
2021-09-13 11:09:00 +02:00
Dmitry Stogov
7fcb45dffa JIT: prefer string reallocation instead of allocation/memcpy/deallocation 2021-09-07 15:28:15 +03:00
Dmitry Stogov
d4ed6b635f JIT: Update run_time_cache slot in zend_jit_find_func helper 2021-09-07 13:13:47 +03:00
Nikita Popov
5b2ddf5a17 Export zend_use_resource_as_offset()
Use a common implementation to generate this error message, as
we do so in quite a few places dealing with array keys.
2021-08-31 10:58:01 +02:00
Dmitry Stogov
c5ded13614 JIT: Code generation for ROPE_INIT, ROPE_ADD and ROPE_END with STRING operands 2021-08-24 21:45:14 +03:00
Nikita Popov
a3f5b11994 Sync JIT overloaded assign/inc/dec overloaded property
We should only release the read_property return value if
retval is used, same as in zend_execute.c. This fixes a test
failure under PROFITABILITY_CHECKS=0.
2021-07-21 10:45:02 +02:00
Nikita Popov
a190c7fdb7 Sync JIT zend_check_string_offset()
Return after zend_jit_illegal_string_offset() to avoid a redundant
warning during conversion.

This fixes some tests under PROFITABILITY_CHECKS=0.
2021-07-21 10:32:45 +02:00
Levi Morrison
ae8647d9d3
Remove leading underscore for _zend_hash_find_known_hash (#7260)
Convert zend_hash_find_ex(..., 1) to zend_hash_find_known_hash(...)
Convert zend_hash_find_ex(..., 0) to zend_hash_find(...)

Also add serializable changes to UPGRADING.INTERNALS summary
2021-07-20 17:07:17 -06:00
Nikita Popov
6780aaa532 Implement readonly properties
Add support for readonly properties, for which only a single
initializing assignment from the declaring scope is allowed.

RFC: https://wiki.php.net/rfc/readonly_properties_v2

Closes GH-7089.
2021-07-20 12:05:46 +02:00
Kamil Tekiela
052af90b86 Deprecate autovivification on false
Deprecate automatically converting "false" into an empty array
on write operands. Autovivification continues to be supported
for "null" values, as well as undefined/uninitialized values.

RFC: https://wiki.php.net/rfc/autovivification_false

Closes GH-7131.

Co-authored-by: Tyson Andre <tysonandre775@hotmail.com>
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 14:49:37 +02:00
Nikita Popov
6776e0557e Merge branch 'PHP-8.0'
* PHP-8.0:
  Add exception check to zend_jit_fetch_obj_w_slow()
2021-07-14 16:58:16 +02:00