Make WordPress Core


Ignore:
Timestamp:
10/10/2017 05:26:53 AM (9 years ago)
Author:
westonruter
Message:

File Editor: Increase robustness of fatal error checking when saving PHP file edits.

  • Increase PHP execution time limit prior to issuing loopback requests where are themselves given timeouts to ensure PHP file can be reverted.
  • Output scrape messages on success and failure so that absence of either can also be flagged as an error condition.
  • Forward browser's HTTP Basic Auth credentials in loopback requests to admin and home URL.
  • Display more helpful message when loopback request fails.

Amends [41721].
See #21622.
Fixes #42102.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r41721 r41805  
    11271127
    11281128        if ( get_transient( 'scrape_key_' . $key ) !== $nonce ) {
    1129                 echo "###### begin_scraped_error:$key ######";
     1129                echo "###### wp_scraping_result_start:$key ######";
    11301130                echo wp_json_encode( array(
    11311131                        'code' => 'scrape_nonce_failure',
    11321132                        'message' => __( 'Scrape nonce check failed. Please try again.' ),
    11331133                ) );
     1134                echo "###### wp_scraping_result_end:$key ######";
    11341135                die();
    11351136        }
    … …  
    11461147function wp_finalize_scraping_edited_file_errors( $scrape_key ) {
    11471148        $error = error_get_last();
    1148         if ( empty( $error ) ) {
    1149                 return;
    1150         }
    1151         if ( ! in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) {
    1152                 return;
    1153         }
    1154         $error = str_replace( ABSPATH, '', $error );
    1155         echo "###### begin_scraped_error:$scrape_key ######";
    1156         echo wp_json_encode( $error );
    1157 }
     1149        echo "\n###### wp_scraping_result_start:$scrape_key ######\n";
     1150        if ( ! empty( $error ) && in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) {
     1151                $error = str_replace( ABSPATH, '', $error );
     1152                echo wp_json_encode( $error );
     1153        } else {
     1154                echo wp_json_encode( true );
     1155        }
     1156        echo "\n###### wp_scraping_result_end:$scrape_key ######\n";
     1157}
Note: See TracChangeset for help on using the changeset viewer.