Commit 96d1b3f
committed
REST API: Restore global post state in WP_REST_Posts_Controller.Ensures that the global $post object is restored to its original state after calling setup_postdata() in prepare_item_for_response(). This fixes a regression where the global context could be 'polluted' during REST API requests.Fixes #43502.
1 parent 4d3b0b9 commit 96d1b3f
File tree
2 files changed
+51
-0
lines changed- src/wp-includes/rest-api/endpoints
- tests/phpunit/tests/rest-api
2 files changed
+51
-0
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1886 | 1886 | | |
1887 | 1887 | | |
1888 | 1888 | | |
| 1889 | + | |
1889 | 1890 | | |
1890 | 1891 | | |
1891 | 1892 | | |
1892 | 1893 | | |
1893 | 1894 | | |
1894 | 1895 | | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
1895 | 1899 | | |
1896 | 1900 | | |
1897 | 1901 | | |
| |||
2207 | 2211 | | |
2208 | 2212 | | |
2209 | 2213 | | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
2210 | 2217 | | |
2211 | 2218 | | |
2212 | 2219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2805 | 2805 | | |
2806 | 2806 | | |
2807 | 2807 | | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
2808 | 2852 | | |
2809 | 2853 | | |
2810 | 2854 | | |
| |||
0 commit comments