Commit d44235a
committed
Convert numeric string array keys to integers correctly in JITted code
While fixing bugs in mbstring, one of my new test cases failed with a strange
error message stating: 'Warning: Undefined array key 1...', when clearly the
array key had been set properly.
GDB'd that sucker and found that JIT'd PHP code was calling directly into
`zend_hash_add_new` (which was not converting the numeric string key to an
integer properly). But where was that code coming from? I examined the disasm,
looked up symbols to figure out where call instructions were going, then grepped
the codebase for those function names. It soon became clear that the disasm I
was looking at was compiled from `zend_jit_fetch_dim_w_helper`.1 parent 904c1b6 commit d44235a
File tree
3 files changed
+48
-5
lines changed- Zend/tests
- ext/opcache/jit
3 files changed
+48
-5
lines changed| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
481 | 484 | | |
482 | 485 | | |
483 | 486 | | |
| |||
509 | 512 | | |
510 | 513 | | |
511 | 514 | | |
512 | | - | |
| 515 | + | |
513 | 516 | | |
514 | 517 | | |
515 | 518 | | |
| |||
550 | 553 | | |
551 | 554 | | |
552 | 555 | | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
553 | 559 | | |
554 | 560 | | |
555 | 561 | | |
| |||
578 | 584 | | |
579 | 585 | | |
580 | 586 | | |
581 | | - | |
| 587 | + | |
582 | 588 | | |
583 | 589 | | |
584 | 590 | | |
| |||
618 | 624 | | |
619 | 625 | | |
620 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
621 | 630 | | |
622 | 631 | | |
623 | 632 | | |
| |||
645 | 654 | | |
646 | 655 | | |
647 | 656 | | |
648 | | - | |
| 657 | + | |
649 | 658 | | |
650 | 659 | | |
651 | 660 | | |
| |||
688 | 697 | | |
689 | 698 | | |
690 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
691 | 703 | | |
692 | 704 | | |
693 | 705 | | |
| |||
726 | 738 | | |
727 | 739 | | |
728 | 740 | | |
729 | | - | |
| 741 | + | |
730 | 742 | | |
731 | 743 | | |
732 | 744 | | |
| |||
769 | 781 | | |
770 | 782 | | |
771 | 783 | | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
772 | 787 | | |
773 | 788 | | |
774 | 789 | | |
| |||
0 commit comments