Skip to content

Instantly share code, notes, and snippets.

@pierlon
Last active May 19, 2020 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pierlon/cb3dc7e78ae99ba48e377d8256de5cb5 to your computer and use it in GitHub Desktop.
Save pierlon/cb3dc7e78ae99ba48e377d8256de5cb5 to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Bad plugin with fatal errors
* Description: For testing purposes only.
* Author: Pierre Gordon
* Version: 0.1.0
* License: GPLv2 or later
*/
// All credit goes to Weston Ruter <https://github.com/westonruter>
// Code below is adapted from an example given in https://github.com/ampproject/amp-wp/issues/4580.
add_action( 'wp_footer', function() {
for ( $i = 0; $i < 8; $i++ ) {
if ( $i >= 4 && AMP_Validation_Manager::$is_validate_request ) {
throw new Exception( 'FAIL' );
}
echo "<script>// bad: $i</script>";
}
} );
@pierlon
Copy link
Author

pierlon commented May 19, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment