Repository navigation
Commit c194f64
committed
Fix GH-23911: Cached static closure keeps static:: of the first called class
The stateless closure cache in ZEND_DECLARE_LAMBDA_FUNCTION stored a single
closure per opline. Since the declaring op_array is shared by all subclasses,
the closure created for the first called scope was returned for every other
called scope, breaking static::, new static() and get_called_class().
Store the called scope alongside the cached closure and only reuse the closure
for a matching called scope. The slot is only filled once, as replacing the
cached closure on a mismatch would grow EG(lambda_cache) without bounds.
Fixes GH-23911
Signed-off-by: Roman Ondráček <mail@romanondracek.cz>1 parent 464c95a commit c194f64
5 files changed
Lines changed: 107 additions & 38 deletions
File tree
- Zend
- Optimizer
- tests/closures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
760 | | - | |
761 | 760 | | |
762 | 761 | | |
763 | 762 | | |
764 | 763 | | |
765 | 764 | | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
766 | 771 | | |
767 | 772 | | |
768 | 773 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9273 | 9273 | | |
9274 | 9274 | | |
9275 | 9275 | | |
| 9276 | + | |
9276 | 9277 | | |
9277 | | - | |
| 9278 | + | |
9278 | 9279 | | |
9279 | 9280 | | |
9280 | 9281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8420 | 8420 | | |
8421 | 8421 | | |
8422 | 8422 | | |
| 8423 | + | |
| 8424 | + | |
| 8425 | + | |
| 8426 | + | |
| 8427 | + | |
| 8428 | + | |
8423 | 8429 | | |
8424 | | - | |
| 8430 | + | |
| 8431 | + | |
| 8432 | + | |
8425 | 8433 | | |
8426 | 8434 | | |
8427 | 8435 | | |
8428 | 8436 | | |
8429 | 8437 | | |
8430 | 8438 | | |
8431 | 8439 | | |
8432 | | - | |
8433 | | - | |
8434 | | - | |
8435 | | - | |
8436 | | - | |
8437 | | - | |
8438 | | - | |
8439 | | - | |
| 8440 | + | |
| 8441 | + | |
| 8442 | + | |
| 8443 | + | |
8440 | 8444 | | |
8441 | | - | |
8442 | 8445 | | |
8443 | 8446 | | |
8444 | 8447 | | |
8445 | 8448 | | |
8446 | 8449 | | |
8447 | | - | |
| 8450 | + | |
| 8451 | + | |
| 8452 | + | |
| 8453 | + | |
8448 | 8454 | | |
8449 | 8455 | | |
8450 | | - | |
| 8456 | + | |
8451 | 8457 | | |
8452 | 8458 | | |
8453 | 8459 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments