Repository navigation
Commit b3f6bc3
committed
Upgrade/Install: Report fatal errors in auto-update emails.
When a plugin auto-update was rolled back because the loopback request found a fatal error, the failure email gave no reason, even though `WP_Automatic_Updater::has_fatal_error()` had already received the error's message, file, and line in the scrape result. These details are now added to the rollback `WP_Error` under a new `plugin_update_fatal_error` code, so the email lists them under the plugin whose update failed. This works regardless of `WP_DEBUG`, and when the loopback request itself fails, its error message is reported instead, so a rollback is no longer left unexplained.
The details are carried on the plugin's update result rather than in a transient, so that they cannot expire during a long update run, go stale when no email is sent, or be attributed to the wrong plugin when several fail in the same run. This also leaves the signature of the protected `has_fatal_error()` method unchanged for subclasses. Only the first line of the error message is included, since the message for an uncaught exception continues with a stack trace whose argument values, such as database credentials, would otherwise leave the server by email.
The parameters of the `send_plugin_theme_email()` and `after_plugin_theme_update()` methods are also typed with the update result types, so that PHPStan can check the new email code, which resolves a baselined error for a possibly undefined `$subject`.
Developed in WordPress#10445.
Follow-up to r58128, r64435.
Props tlloancy, westonruter, sajib1223, afragen, knutsp, im3dabasia1.
See #65817.
Fixes #64155.
git-svn-id: https://develop.svn.wordpress.org/trunk@64582 602fd350-edb4-49c9-b593-d223f7449a821 parent e205f82 commit b3f6bc3
3 files changed
Lines changed: 206 additions & 5 deletions
File tree
- src/wp-admin/includes
- tests
- phpstan/baselines
- phpunit/tests/admin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
89 | 99 | | |
90 | 100 | | |
91 | 101 | | |
| |||
710 | 720 | | |
711 | 721 | | |
712 | 722 | | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
713 | 727 | | |
714 | 728 | | |
715 | 729 | | |
| |||
1268 | 1282 | | |
1269 | 1283 | | |
1270 | 1284 | | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
1271 | 1292 | | |
1272 | 1293 | | |
1273 | 1294 | | |
| |||
1340 | 1361 | | |
1341 | 1362 | | |
1342 | 1363 | | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1343 | 1368 | | |
1344 | 1369 | | |
1345 | 1370 | | |
| |||
1487 | 1512 | | |
1488 | 1513 | | |
1489 | 1514 | | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1490 | 1522 | | |
1491 | 1523 | | |
1492 | 1524 | | |
| |||
1862 | 1894 | | |
1863 | 1895 | | |
1864 | 1896 | | |
| 1897 | + | |
1865 | 1898 | | |
1866 | 1899 | | |
1867 | 1900 | | |
| |||
1870 | 1903 | | |
1871 | 1904 | | |
1872 | 1905 | | |
| 1906 | + | |
| 1907 | + | |
1873 | 1908 | | |
1874 | 1909 | | |
1875 | 1910 | | |
| |||
1916 | 1951 | | |
1917 | 1952 | | |
1918 | 1953 | | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
1919 | 1960 | | |
1920 | 1961 | | |
1921 | 1962 | | |
| |||
1937 | 1978 | | |
1938 | 1979 | | |
1939 | 1980 | | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
1940 | 1994 | | |
1941 | 1995 | | |
1942 | 1996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | 161 | | |
167 | 162 | | |
168 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
756 | 756 | | |
757 | 757 | | |
758 | 758 | | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 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 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
759 | 911 | | |
0 commit comments