1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 20:22:36 +02:00
Commit Graph

4971 Commits

Author SHA1 Message Date
Niels Dossche
e00d684420 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16630: UAF in lexer with encoding translation and heredocs
2024-11-18 19:59:08 +01:00
Niels Dossche
6a632a2d60 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16630: UAF in lexer with encoding translation and heredocs
2024-11-18 19:59:01 +01:00
Niels Dossche
fc1db70f10 Fix GH-16630: UAF in lexer with encoding translation and heredocs
zend_save_lexical_state() can be nested multiple times, for example for
the parser initialization and then in the heredoc lexing. The input
should not be freed if we restore to the same filtered string.

Closes GH-16716.
2024-11-18 19:58:02 +01:00
Ilija Tovilo
048fa7bacc Fix get_object_vars() for non-hooked props in hooked prop iter
The zend_hash_update_ind() variant unwraps indirects, rather than creating them.
Don't use _zend_hash_append_ind() because the property might already exist.

Fixes GH-16725
Closes GH-16805
2024-11-18 16:20:19 +01:00
Niels Dossche
6a55beef90 Fix test expectation for different closure name in 8.4 2024-11-15 20:32:59 +01:00
Niels Dossche
4a5854ee62 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16799: Assertion failure at Zend/zend_vm_execute.h:7469
2024-11-15 20:03:26 +01:00
Niels Dossche
ed59c00661 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16799: Assertion failure at Zend/zend_vm_execute.h:7469
2024-11-15 20:03:19 +01:00
Niels Dossche
553d79c709 Fix GH-16799: Assertion failure at Zend/zend_vm_execute.h:7469
zend_is_callable_ex() can unfortunately emit a deprecation, and then
a user error handler can throw an exception. This causes an assert
failure at ZEND_VM_NEXT_OPCODE(). We fix this by checking if there's an
exception after zend_is_callable_ex().

Closes GH-16803.
2024-11-15 20:02:26 +01:00
Ilija Tovilo
230defc198 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix array going away during sorting
2024-11-04 15:51:24 +01:00
Ilija Tovilo
f033cf75e4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix array going away during sorting
2024-11-04 15:51:03 +01:00
Ilija Tovilo
2bdce61390 Fix array going away during sorting
Fixes GH-16648
Closes GH-16654
2024-11-04 15:50:35 +01:00
Arnaud Le Blanc
54a40f3bde Add ReflectionProperty::isLazy()
Closes GH-16342
2024-10-31 14:14:20 +01:00
Arnaud Le Blanc
3d3b22ddf2 Fix assertion failure in zend_std_read_property
We asserted that Z_PROP_FLAG_P(retval) was exactly IS_PROP_UNINIT, but this is a
bit field and it may contain irrelevant bits. For instance it may contain
IS_PROP_REINITABLE during clone, or IS_PROP_LAZY if the object is lazy.

Fixes GH-16615
Closes GH-16639
2024-10-30 12:02:52 +01:00
Christoph M. Becker
7cc327fd5a Dynamically xfail test case which fails on CI
This is a stop-gap measure for GH-15709 to keep CI green.

Sorry, xfailed the wrong test case previously.
2024-10-23 13:58:07 +02:00
Christoph M. Becker
bdde797159 Dynamically xfail test case which fails on CI
This is a stop-gap measure for GH-15709 to keep CI green.
2024-10-23 13:11:12 +02:00
Ilija Tovilo
dded6fdcad Fix gh16508.phpt test expectation
The error changed in master, not 8.4. My bad.
2024-10-22 22:07:03 +02:00
Ilija Tovilo
5a639c5522 [skip ci] Fix test expectation of gh16508.phpt for 8.4+ 2024-10-22 15:18:24 +02:00
Ilija Tovilo
077d69db44 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix lineno for inheritance errors of early bound classes
2024-10-22 15:17:29 +02:00
Ilija Tovilo
e02085359d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix lineno for inheritance errors of early bound classes
2024-10-22 15:17:11 +02:00
Ilija Tovilo
2d068c4f47 Fix lineno for inheritance errors of early bound classes
Fixes GH-16508
Closes GH-16532
2024-10-22 15:16:43 +02:00
Ilija Tovilo
cd8ee4dad1 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix lineno in function redeclaration error
2024-10-22 15:06:06 +02:00
Ilija Tovilo
381e020edb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix lineno in function redeclaration error
2024-10-22 15:05:29 +02:00
Ilija Tovilo
de7ef3fa66 Fix lineno in function redeclaration error
We were previously using the lineno of the first instruction, rather than the
start of the function itself.

Fixes GH-16509
Closes GH-16531
2024-10-22 15:04:20 +02:00
Ilija Tovilo
9a093e753a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix propagation of ZEND_ACC_RETURN_REFERENCE for call trampoline
2024-10-22 14:49:27 +02:00
Ilija Tovilo
5eddcb313e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix propagation of ZEND_ACC_RETURN_REFERENCE for call trampoline
2024-10-22 14:48:58 +02:00
Ilija Tovilo
8720063c4e Fix propagation of ZEND_ACC_RETURN_REFERENCE for call trampoline
Fixes GH-16515
Closes GH-16529
2024-10-22 14:47:01 +02:00
Arnaud Le Blanc
64081d1380 Lazy objects: Update class constants earlier
If a lazy object is created for a class whose constants can not be updated, then
we have created an instance of a non-instantiable class. This breaks the
expectations of clone.

Here I ensure that a class has its constants updated before creating a lazy
instance of it.

Fixes OSS-Fuzz #71407
Closes GH-15856
2024-10-22 12:19:31 +02:00
Ilija Tovilo
a8bbc84551 Disallow asymmetric visibility on static properties
This check was forgotten in the original implementation. Relaxing this
restriction shouldn't be hard, but needs some work. We either need to prevent
merging of cache slots for R/RW/W, or we need to introduce an additional check
when writing to the property indirectly. This check is currently present only
for direct writes.

Closes GH-16462
2024-10-16 23:00:11 +02:00
Arnaud Le Blanc
8aa32601dc Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix handling of invalid iterator in zend_weakmap_iterator_get_current_key()
2024-10-15 12:23:45 +02:00
Arnaud Le Blanc
900afb6ff0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix handling of invalid iterator in zend_weakmap_iterator_get_current_key()
2024-10-15 12:23:00 +02:00
Arnaud Le Blanc
1d94fb86b7 Fix handling of invalid iterator in zend_weakmap_iterator_get_current_key()
Fixes GH-16371
Closes GH-16436
2024-10-15 12:22:35 +02:00
Ilija Tovilo
b1bd4e6a5c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix deprecation warnings in tests
2024-10-14 14:28:04 +02:00
Ilija Tovilo
817d21ecc4 Fix deprecation warnings in tests 2024-10-14 14:27:56 +02:00
Ilija Tovilo
5f2f1a5702 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix exception in assert() callback with bail enabled
2024-10-14 14:01:16 +02:00
Ilija Tovilo
f512ff4afa Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix exception in assert() callback with bail enabled
2024-10-14 14:00:20 +02:00
Ilija Tovilo
b5c09b1a61 Fix exception in assert() callback with bail enabled
Fixes GH-16293
Closes GH-16304
2024-10-14 13:59:26 +02:00
Ilija Tovilo
3546733065 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix array to string conversion warning emitted in optimizer
2024-10-14 13:25:31 +02:00
Ilija Tovilo
c5745f40a5 Fix array to string conversion warning emitted in optimizer
Fixes GH-16408
Closes GH-16380
2024-10-14 13:24:05 +02:00
Niels Dossche
e0b1b693e3 Fix OSS-Fuzz #371445205: Heap-use-after-free in attr_free
zend_hash_get_current_key() does not return a string with incremented
refcount, so it shouldn't get released. This release caused a UAF later
when the attribute was destroyed. This wasn't noticed earlier because
object_init_with_constructor() was only ever tested with interned
strings.

Closes GH-16349.
2024-10-11 09:07:08 +02:00
Ilija Tovilo
d76ef13757 Fix various hooked object iterator issues
Fixes GH-16185
Closes GH-16281
2024-10-08 13:35:33 +02:00
Arnaud Le Blanc
c1ea9b173f Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for GH-16196
  NEWS for GH-16196
  Handle references properties of the Exception class
2024-10-07 15:04:24 +02:00
Arnaud Le Blanc
498e88489e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS for GH-16196
  Handle references properties of the Exception class
2024-10-07 15:03:55 +02:00
Arnaud Le Blanc
c2115a43e3 Handle references properties of the Exception class
Fixes GH-16188
Closes GH-16196
2024-10-07 15:03:31 +02:00
Arnaud Le Blanc
443aa29dbe Support stack limit in phpdbg SAPI
Fixes GH-16041
Closes GH-16055
2024-10-03 15:22:51 +02:00
Arnaud Le Blanc
c9dfb77446 Deny resetting an object as lazy during property iteration
Supporting object reset while its properties are being iterated would increase
complexity for little benefit. Furthermore it may not be possible to ensure a
consistent behavior between ghosts and proxies (wrt to iteration position).

Iteration is detected by checking if the object's properties ht has iterators.
This requires refactoring the hooked get_iterator() implementation to ensure
that it creates a properties ht iterator immediately.

Closes GH-15960
2024-10-03 15:12:21 +02:00
Arnaud Le Blanc
4d7fcea5da Fix handling of undef property during foreach by ref on hooked class 2024-10-03 15:12:21 +02:00
Niels Dossche
577eb68212 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15169: stack overflow when var serialization in ext/standard/var
2024-10-02 21:32:20 +02:00
Niels Dossche
bd724bdf42 Fix GH-15169: stack overflow when var serialization in ext/standard/var
Adding a stack check here as I consider serialization to be a more
sensitive place where erroring out with an exception seems appropriate.

Closes GH-16159.
2024-10-02 21:30:59 +02:00
Arnaud Le Blanc
bc317d3afc Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] NEWS for GH-16025
  [ci skip] NEWS for GH-16025
  Fix assertion failure in generator dtor (#16025)
2024-10-02 12:33:06 +02:00
Arnaud Le Blanc
7e6616cafb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS for GH-16025
  Fix assertion failure in generator dtor (#16025)
2024-10-02 12:31:21 +02:00