Commit graph

17977 commits

Author SHA1 Message Date
Pierrick Charron
1793f8dada
Prepare 8.2.3 branch 2023-02-05 14:19:24 -05:00
Arnaud Le Blanc
36d55f8918
Handle non-INDIRECT symbol table entries in zend_fiber_object_gc() (#10386)
Fixes GH-10340
2023-01-27 20:26:58 +03:00
Bob Weinand
a6a20c9e17 Add regression test for e560592a61
Reproduces only under ASAN.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-01-17 11:14:00 +01:00
David Carlier
385f410e4c Merge branch 'PHP-8.1' into PHP-8.2 2023-01-16 20:43:08 +00:00
Niels Dossche
dfe9c2af19 Fix incorrect comparison in block optimization pass
We're in the case of ZEND_JMPZ_EX or ZEND_JMPNZ_EX. The opcode gets
overwritten and only after the overwriting gets checked if we're in a
JMPZ or JMPNZ case. This results in a wrong optimization.

Close GH-10329
2023-01-16 20:41:33 +00:00
Petar Obradović
e560592a61 Fix GH-9675: Re-adjust run_time_cache init for internal enum methods
Closes GH-10143.
2023-01-16 17:38:38 +01:00
Arnaud Le Blanc
d89408075f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Reduce HT_MAX_SIZE to account for the max load factor of 0.5 (#10242)
  GC fiber unfinished executions (#9810)
2023-01-13 12:28:21 +01:00
Arnaud Le Blanc
0f7625c47c
Reduce HT_MAX_SIZE to account for the max load factor of 0.5 (#10242)
zend_hash allocates a hash table twice as big as nTableSize
(HT_HASH_SIZE(HT_SIZE_TO_MASK(nTableSize)) == nTableSize*2), so HT_MAX_SIZE
must be half the max table size or less.

Fixes GH-10240
2023-01-13 12:05:51 +01:00
Arnaud Le Blanc
4fb149390a
GC fiber unfinished executions (#9810) 2023-01-13 12:04:28 +01:00
David Carlier
884e8a970a Merge branch 'PHP-8.1' into PHP-8.2 2023-01-12 22:01:30 +00:00
Niels Dossche
833b45ac44 Fix GH-10249: Assertion `size >= page_size + 1 * page_size' failed.
Co-authored-by: Changochen <changochen1@gmail.com>

Closes GH-10284
2023-01-12 22:00:00 +00:00
George Peter Banyard
c936c02119
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  fix: indirect_return compilation warning
2023-01-10 15:23:35 +00:00
Kévin Dunglas
55514a1119
fix: indirect_return compilation warning
Closes GH-10274

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-10 15:23:15 +00:00
Dmitry Stogov
9abc2108fa Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect optimization of ASSIGN_OP may lead to incorrect result (sub assign -> pre dec conversion for null values)
2023-01-09 13:53:19 +03:00
Dmitry Stogov
4d4a53beee Fix incorrect optimization of ASSIGN_OP may lead to incorrect result (sub assign -> pre dec conversion for null values) 2023-01-09 13:51:57 +03:00
Christoph M. Becker
6faeb9571d
Fix recently introduced gh10251.phpt
As of PHP 8.2.0, creation of dynamic properties is deprecated, so we
slap a `AllowDynamicProperties` attribute on the class.
2023-01-08 18:07:21 +01:00
George Peter Banyard
e308dc0635 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10251: Assertion `(flag & (1<<3)) == 0' failed.
  Fix GH-9710: phpdbg memory leaks by option "-h"
2023-01-08 16:11:46 +00:00
Niels Dossche
d03025bf59 Fix GH-10251: Assertion `(flag & (1<<3)) == 0' failed.
zend_get_property_guard previously assumed that at least "str" has a
pre-computed hash. This is not always the case, for example when a
string is created by bitwise operations, its hash is not set. Instead of
forcing a computation of the hashes, drop the hash comparison.

Closes GH-10254

Co-authored-by: Changochen <changochen1@gmail.com>

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-08 16:09:59 +00:00
Niels Dossche
df96346f9c Move test for GH-10200 to the simplexml extension test directory
Closes GH-10252

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-07 03:07:37 +00:00
George Peter Banyard
de633c31dd Add missing EXTENSIONS section to test file gh10200 2023-01-05 13:10:28 +00:00
Niels Dossche
c2404915e0 Fix GH-10200: zif_get_object_vars: Assertion `!(((__ht)->u.flags & (1<<2)) != 0)' failed.
This occurs because the array of properties is a single element with an
integer key, not an associative array. Therefore it is a packed array
and thus the assumption the iteration macro makes is invalid.

This restores the behaviour of PHP<8.2.

Closes GH-10209

Co-authored-by: Deltik <deltik@gmx.com>

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-02 15:46:58 +00:00
Dmitry Stogov
0464524292 Fix memory leak because of incorrect optimization
Fixes oss-fuzz #54488
2022-12-26 13:20:55 +03:00
Derick Rethans
9529b8919f Merge branch 'PHP-8.1' into PHP-8.2 2022-12-23 16:36:40 +00:00
George Peter Banyard
44add3c791 Add secondary test that registers a trampoline as a shutdown function 2022-12-23 16:34:57 +00:00
Derick Rethans
b489e0f2b8 Make sure to disable JIT when overriding execute_ex 2022-12-23 16:34:57 +00:00
Derick Rethans
233ffccc35 Fix GH-10072: PHP crashes when execute_ex is overridden and a __call trampoline is used from internal code 2022-12-23 16:34:57 +00:00
Remi Collet
bfa56cf62b
Fix #10133 set variables_order en ensure $ENV is set 2022-12-20 16:40:47 +01:00
Dmitry Stogov
f763cfd3d5 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak
2022-12-19 12:11:55 +03:00
Dmitry Stogov
683285165e Fix memory leak
Fixes oss-fuzz #54320
2022-12-19 12:11:16 +03:00
Pierrick Charron
002d54db9f
PHP-8.2 is now for PHP 8.2.2-dev 2022-12-13 19:29:29 -05:00
Ben Ramsey
696bb385df
PHP-8.1 is now for PHP 8.1.15-dev 2022-12-07 11:29:37 -06: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
Christoph M. Becker
6b1f4c5a44
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9769: Misleading error message for unpacking of objects
2022-12-02 13:11:51 +01:00
蝦米
93592ea743
Fix GH-9769: Misleading error message for unpacking of objects
Only arrays can be unpacked in constant expressions.

Closes GH-9776.
2022-12-02 13:10:59 +01:00
George Peter Banyard
86456574bb
Fix performance degradation introduced in c2547ab7dc
After discussing with someone, our current running theory is that the local
variable forces the compiler to reserve an additional register for the whole
lifespan of the function. Dropping it and just loading the value should restore
the previous code generation.

Closes GH-9876
2022-11-22 12:35:25 +00:00
Dmitry Stogov
45cb3f917a Fix a memory leak in tracig JIT when the same closure is called through Closure::call() and natively.
Closure::call() makes a temporary copy of original closure function, modifies its
scope, resets ZEND_ACC_CLOSURE flag and call it through zend_call_function().
As result the same function may be called with and without
ZEND_ACC_CLOSURE flag, that confuses JIT and may lead to memory leak or
even worse memory errors.

The patch allocates "fake" closure object and keep ZEND_ACC_CLOSURE flag
to always behave in the same way.
2022-11-21 17:41:16 +03:00
Christoph M. Becker
c6204ac930
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9650: Can't initialize heap: [0x000001e7]
2022-11-17 14:18:51 +01:00
Michael Voříšek
8d65c2fee5
Fix GH-9650: Can't initialize heap: [0x000001e7]
Closes GH-9721.
2022-11-17 14:16:10 +01:00
Bob Weinand
182314c317 Do not report MINIT stage internal class aliases in extensions
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-11-09 16:36:05 +01:00
Bob Weinand
6bd8f40291 Move observer_declared_function_notify until after pass_two()
For early observing, there already exists a op_array_ctor hook on zend_extension.
However the goal of the declared_function observer is noting the time when a fully defined function starts existing in the function_tables.
This also prevents the observer being called in case there were compilation errors.

Ultimately, this now gives a consistent behaviour with respect to how it works when opcache is enabled:
- pass_two is done, opcodes and flags are all finalized.
- similarly class_linked notifications also only happen once the class is actually finalized.
- any extension wanting to delay the observer call may add the ZEND_COMPILE_IGNORE_OBSERVER compiler_option, then call it itself.
2022-11-09 13:15:41 +01:00
Pierrick Charron
44d652c00a
PHP-8.2 is now for PHP 8.2.1-dev and prepare NEWS for 8.2.0 2022-11-08 13:26:35 -05:00
Patrick Allaert
540488c74e
PHP-8.1 is now for PHP 8.1.14-dev 2022-11-08 17:57:34 +01:00
Dmitry Stogov
05b63b1593 Don't check "fake" closures (fix assertion)
Fixes oss-fuzz #53078
2022-11-07 12:19:54 +03:00
Dmitry Stogov
de4b502fef Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak
2022-11-07 11:08:54 +03:00
Dmitry Stogov
f31f464cec Fix memory leak
Fixes oss-fuzz #52999
2022-11-07 11:07:58 +03:00
Arnaud Le Blanc
34a85fbea0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix generator memory leaks when interrupted during argument evaluation (#9756)
2022-11-04 16:02:04 +01:00
Arnaud Le Blanc
4011657719 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Fix generator memory leaks when interrupted during argument evaluation (#9756)
2022-11-04 15:59:14 +01:00
Arnaud Le Blanc
5d1f3e047c
Fix generator memory leaks when interrupted during argument evaluation (#9756) 2022-11-04 15:55:55 +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