Repository navigation
Commit eb1dff0
committed
Query: Prevent
The documented return type is `WP_Term|WP_Post_Type|WP_Post|WP_User|null`, but `get_queried_object()` could return `false` from author queries because `get_userdata()` yields `false` when the resolved author ID is `null` or matches no user. Guard the `get_userdata()` call and its result so `$this->queried_object` stays `null` in those cases. The adjacent posts page branch is hardened the same way, since `get_post()` can return `null` for a missing or deleted page, which previously caused a property access on `null`.
Developed in #12069.
Follow-up to r52822, r3290.
Props tusharbharti, tommusrhodus, yusufmudagal, westonruter.
Fixes #65400.
git-svn-id: https://develop.svn.wordpress.org/trunk@62476 602fd350-edb4-49c9-b593-d223f7449a82get_queried_object() from returning false.1 parent 55e3325 commit eb1dff0
2 files changed
Lines changed: 55 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4019 | 4019 | | |
4020 | 4020 | | |
4021 | 4021 | | |
4022 | | - | |
4023 | 4022 | | |
4024 | 4023 | | |
4025 | 4024 | | |
4026 | 4025 | | |
4027 | 4026 | | |
4028 | 4027 | | |
4029 | | - | |
4030 | | - | |
4031 | | - | |
4032 | | - | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
4033 | 4033 | | |
4034 | 4034 | | |
4035 | 4035 | | |
| |||
4041 | 4041 | | |
4042 | 4042 | | |
4043 | 4043 | | |
4044 | | - | |
4045 | 4044 | | |
4046 | 4045 | | |
4047 | 4046 | | |
4048 | 4047 | | |
4049 | 4048 | | |
4050 | | - | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
4051 | 4055 | | |
4052 | 4056 | | |
4053 | 4057 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
726 | 770 | | |
727 | 771 | | |
728 | 772 | | |
| |||
0 commit comments