Commit 9bc4e2f
committed
Taxonomy: Check the result of
`get_term()` can return `WP_Error` or `null` on failure, so the result should be verified as a `WP_Term` instance before accessing the `count` property.
This commit prevents a PHP warning if `get_term()` returns `null` for a child term:
{{{
Warning: Attempt to read property "count" on null
}}}
Follow-up to [27458], [37572].
Props josephscott, coleatkinson1, kebbet, jakariaistauk, sabernhardt, westonruter, SergeyBiryukov.
Fixes #63877.
git-svn-id: https://develop.svn.wordpress.org/trunk@60661 602fd350-edb4-49c9-b593-d223f7449a82get_term() in WP_Term_Query::get_terms().1 parent 06aca12 commit 9bc4e2f
File tree
2 files changed
+49
-1
lines changed- src/wp-includes
- tests/phpunit/tests/term
2 files changed
+49
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
849 | 849 | | |
850 | 850 | | |
851 | 851 | | |
852 | | - | |
| 852 | + | |
| 853 | + | |
853 | 854 | | |
854 | 855 | | |
855 | 856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
855 | 902 | | |
856 | 903 | | |
857 | 904 | | |
| |||
0 commit comments