Last active
May 19, 2020 02:19
-
-
Save pierlon/cb3dc7e78ae99ba48e377d8256de5cb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>"; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation instructions: https://gist.github.com/westonruter/6110fbc4bef0c4b8c021a112012f7e9c.