Skip to content

Instantly share code, notes, and snippets.

@dsawardekar
Created August 9, 2017 18:18
Show Gist options
  • Save dsawardekar/2a3e22d57d43de3ecfc726c4c28e7186 to your computer and use it in GitHub Desktop.
Save dsawardekar/2a3e22d57d43de3ecfc726c4c28e7186 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Bad Plugin
Description: Bad Plugin for testing PHP errors in QM
Version: 0.1.0
Author: Darshan Sawardekar
License: GPL v2 or later
*/
function bad_plugin_main() {
add_filter( 'qm/collect/silent_php_errors', function( $table ) {
$table['bad-plugin'] = E_ALL & ~E_NOTICE & ~E_WARNING;
return $table;
} );
add_filter( 'qm/collect/hide_silent_php_errors', function( $hide ) {
return false; // true will hide these errors
} );
bp_unknown_variable();
bp_warning();
}
function bp_unknown_variable() {
$a = $unknown * $unknown;
}
function bp_warning() {
preg_match( 'foo', array() );
}
bad_plugin_main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment