File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 5151 }
5252
5353 // Important: replace only line by line, so the generated source lines will map 1:1 to the initial user input!
54- $ code = preg_replace ('{^\s*<\?(php)?}i ' , '' , $ _POST ['code ' ]);
54+ $ code = preg_replace ('{^\s*<\?(php)?\s* }i ' , '' , $ _POST ['code ' ]);
5555
5656 // if there's only one line wrap it into a krumo() call
5757 if (preg_match ('#^(?!var_dump|echo|print|< )([^\r\n]+?);?\s*$#is ' , $ code , $ m ) && trim ($ m [1 ])) {
7070 }
7171
7272 ob_start ();
73- $ start = microtime (true );
7473 $ memBefore = memory_get_usage (true );
75-
74+ $ start = microtime (true );
75+
7676 eval ($ code );
77-
77+
7878 // compare with peak, because regular memory could be free'd already
79- $ memAfter = memory_get_peak_usage (true );
8079 $ end = microtime (true );
80+ $ memAfter = memory_get_peak_usage (true );
8181 $ debugOutput .= ob_get_clean ();
82-
82+
8383 if (isset ($ _GET ['js ' ])) {
8484 header ('Content-Type: text/plain ' );
85-
85+
8686 $ memory = sprintf ('%.3f ' , ($ memAfter - $ memBefore ) / 1024.0 / 1024.0 ); // in MB
8787 $ rendertime = sprintf ('%.3f ' , (($ end - $ start ) * 1000 )); // in ms
88-
88+
8989 header ('X-Memory-Usage: ' . $ memory );
9090 header ('X-Rendertime: ' . $ rendertime );
91-
91+
9292 echo $ debugOutput ;
9393 die ('#end-php-console-output# ' );
9494 }
You can’t perform that action at this time.
0 commit comments