-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathdebug-tools.php
35 lines (26 loc) · 816 Bytes
/
debug-tools.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/*
Snippet Name: Code blocks for debugging
Version: 0.1.1
Description: Use these blocks to find errors in PHP code.
Snippet URI: https://github.com/szepeviktor/wordpress-plugin-construction
*/
/*
Trace of all PHP-FPM processes
strace -s 200 -p $(pgrep -u root php5-fpm) -f 2>&1 | tee php-fpm.trc
*/
// Is it executed?
echo "<!-- MARK -|-|- {$var} -->" . PHP_EOL; // FIXME
// Is it executed?
error_log( ' -- MARK -- ' . serialize( $var ) ); // FIXME
// What files were executed?
register_shutdown_function( function () {
echo "<!-- \n";
foreach ( get_included_files() as $i => $path ) {
printf( '%04d: %s%s', $i, $path, "\n" );
}
echo " -->\n";
ob_flush();
}); // FIXME
// Where does this get called from?
echo "\nTrace: "; var_dump( debug_backtrace() ); exit; // FIXME