@@ -66,7 +66,7 @@ public static function setErrorHandler( $dieOnFatal = true )
6666 {
6767 ini_set ( 'display_errors ' , false );
6868 ini_set ( 'html_errors ' , false );
69- if ( !@ static ::$ _options [ 'error_reporting ' ] )
69+ if ( !isset ( static ::$ _options [ 'error_reporting ' ] ) )
7070 {
7171 @static ::$ _options [ 'error_reporting ' ] = static ::$ _defaultOptions [ 'error_reporting ' ];
7272 }
@@ -152,15 +152,19 @@ public static function load( $options = null )
152152 set_exception_handler ( array ( $ called_class , 'exceptionHandler ' ) );
153153 $ buffer .= "<br>Exception Handler turned on! " ;
154154 }
155- if ( static ::$ _options [ 'debug_console ' ] ) // try to laod the console class
155+ if ( static ::$ _options [ 'debug_console ' ] ) // try to load the console class
156156 {
157157 static ::$ _consoleStarted = false ;
158158 $ buffer .='<br>Console debug turned on ' ;
159159 if ( file_exists ( dirname ( __FILE__ ) . '/PhpConsole/__autoload.php ' ) )
160160 {
161161 require_once ( dirname (__FILE__ ).'/PhpConsole/__autoload.php ' );
162162 static ::$ _consoleStarted = true ;
163- \PhpConsole \Helper::register ( );
163+ $ instance = \PhpConsole \Connector::getInstance ( );
164+ $ instance ->setHeadersLimit ( static ::$ _options [ 'max_header_size ' ] );
165+ $ instance ->getDebugDispatcher ( )->setDumper (
166+ new \PhpConsole \Dumper ( static ::$ _options [ 'max_dump_depth ' ] ) );
167+ //$instance->getDebugDispatcher( )->detectTraceAndSource = true;
164168 $ buffer .= ", phpConsole class started! " ;
165169 }
166170 else { $ buffer .= ', but could not find phpConsole class! ' ; }
@@ -636,7 +640,8 @@ public static function msgType( $msg = NULL )
636640 'enable_inspector ' => true , // enable variables inspector, use declare(ticks=n); in code block
637641 'code_coverage ' => true , // enable code coverage analysis, use "full" to start globally
638642 'trace_functions ' => true , // enable function calls tracing, use "full" to start globally
639- 'exclude_categories ' => array ( 'Event Manager ' , 'Autoloader ' , 'Router Config ' , 'View Config ' ) // exclude categories from the output
643+ 'exclude_categories ' => array ( ) , // exclude categories from the output
644+ 'max_header_size ' => 4096 // maximum header size for phpconsole
640645 );
641646 /**
642647 * Array of methods excluded from the backtrace
@@ -736,10 +741,13 @@ public static function msgType( $msg = NULL )
736741 .msgTable tr.php-warning td{background-color:yellow;}
737742 .msgTable tr.php-error td{background-color:orange;}
738743 .msgTable tr.inspector td{background-color:lightgreen;}
739- .innerTable a.php-notice{color:lightblue;}
740- .innerTable a.exception{color:greenyellow;}.innerTable a.php-warning{color:yellow;}
741- .innerTable a.php-error{color:orange;}.innerTable a.inspector{color:lightgreen;}
742- .innerTable a.general{color:darkgrey;}.innerTable a.show-all{color:red;}
744+ .innerTable a.php-notice{color:lightblue;!important;}
745+ .innerTable a.exception{color:greenyellow !important;}
746+ .innerTable a.php-warning{color:yellow !important;}
747+ .innerTable a.php-error{color:orange !important;}
748+ .innerTable a.inspector{color:lightgreen !important;}
749+ .innerTable a.general{color:darkgrey !important;}
750+ .innerTable a.show-all{color:red !important;}.innerTable a.top-links{color:white;}
743751 #ptcDebugFilterBar{background-color:black;margin-bottom:8px;padding:4px;
744752 font-size:13px;}.innerTable{z-index:10000;position:relative;background:#eee;
745753 height:300px;padding:30px 10px 0 10px;overflow:auto;clear:both;}
@@ -782,8 +790,8 @@ protected static function _debugConsole()
782790 $ arr =array ( 'errline ' => $ php_trace [ 'line ' ] , 'errfile ' => $ php_trace [ 'file ' ] );
783791 }
784792 $ statement = ( @$ arr [ 'console_statement ' ] ) ?
785- strip_tags ( preg_replace ( "=<br */?>=i " , "\n" ,
786- @$ arr [ 'console_statement ' ] ) ) : null ;
793+ strip_tags ( preg_replace ( "=<br */?>=i " , "\n" ,
794+ @$ arr [ 'console_statement ' ] ) ) : null ;
787795 $ statement .= ( @$ arr [ 'console_time ' ] ) ? ' [time: ' . $ arr [ 'console_time ' ] . '] ' : '' ;
788796 $ console_type = '[ ' . @end ( @explode ( '/ ' , $ arr [ 'errfile ' ][ 0 ] ) ) . ': ' ;
789797 $ console_type .= $ arr [ 'errline ' ][ 0 ] . '] ' ;
@@ -797,24 +805,24 @@ protected static function _debugConsole()
797805 }
798806 else
799807 {
800- \ PC :: debug ( $ console_type , $ arr [ 'console_category ' ] . '.file ' );
808+ $ handler -> debug ( $ console_type , strtolower ( $ arr [ 'console_category ' ] ) . '.file ' );
801809 if ( $ statement )
802- {
803- \ PC :: debug ( $ statement , $ arr [ 'console_category ' ] . '.message ' );
810+ {
811+ $ handler -> debug ( $ statement , strtolower ( $ arr [ 'console_category ' ] ) . '.message ' );
804812 }
805813 if ( @$ arr [ 'console_string ' ] )
806814 {
807- \ PC :: debug ( $ arr [ 'console_string ' ] , $ arr [ 'console_category ' ] . '.result ' );
815+ $ handler -> debug ( $ arr [ 'console_string ' ] , strtolower ( $ arr [ 'console_category ' ] . '.data ' ) );
808816 }
809817 if ( @$ arr [ 'errfile ' ] )
810818 {
811819 unset( $ arr [ 'errfile ' ][ 0 ] );
812820 if ( !empty ( $ arr [ 'errfile ' ] ) )
813821 {
814- \ PC :: debug ( $ arr [ 'errfile ' ] , $ arr [ 'console_category ' ] . '.trace ' );
822+ $ handler -> debug ( $ arr [ 'errfile ' ] , strtolower ( $ arr [ 'console_category ' ] . '.trace ' ) );
815823 }
816824 }
817- //\PC:: debug( $arr , $arr[ 'console_category' ] . '[full]' );
825+ //$handler-> debug( $arr , strtolower( $arr[ 'console_category' ] . '[full]' ) );
818826 }
819827 }
820828 }
@@ -826,8 +834,8 @@ protected static function _debugConsole()
826834 }
827835 $ time = ( ( static ::$ _endTime - static ::$ _startTime ) - static ::$ _tickTime );
828836 $ console_final = 'Seconds: ' . round ( $ time , 3 ) . ' | Milliseconds: ' . round ( $ time * 1000 , 3 );
829- \ PC :: debug ( array ( @get_included_files ( ) ) , static ::$ _options [ 'default_category ' ] . '.includedFiles ' );
830- \ PC :: debug ( 'Global Execution Time ' . $ console_final , static ::$ _options [ 'default_category ' ] );
837+ $ handler -> debug ( array ( @get_included_files ( ) ) , strtolower ( static ::$ _options [ 'default_category ' ] . '.includes ' ) );
838+ $ handler -> debug ( 'Global Execution Time ' . $ console_final , strtolower ( static ::$ _options [ 'default_category ' ] ) );
831839 }
832840 /**
833841 * Checks if a given ip has access
@@ -1399,6 +1407,7 @@ protected static function _lastError()
13991407 $ err_type =static ::msgType ( $ error ['type ' ] );
14001408 if ($ err_type =='Php Error ' )
14011409 {
1410+ ini_set ( 'memory_limit ' , memory_get_usage ( true ) + 1000000 );
14021411 $ err =array ('errno ' =>$ err_type ,'errstr ' =>$ error ['message ' ],
14031412 'errfile ' =>$ error ['file ' ],'errline ' =>$ error ['line ' ]);
14041413 static ::_buildBuffer ('log ' ,'{errorHandler} ' ,$ err );
@@ -1502,7 +1511,7 @@ protected static function _buildHtmlTable( $type )
15021511 {
15031512 $ cat_id = str_replace ( ' ' , '- ' , strtolower ( $ k ) );
15041513 $ div .= '<a href="#" onClick="ptc_filter_categories( \'' . $ type .
1505- 'Table \', \'' . $ cat_id . '\')" class=" ' . $ cat_id . '"> ' . $ k . "( " . $ v . ")</a> | " ;
1514+ 'Table \', \'' . $ cat_id . '\')" class="top-links ' . $ cat_id . '"> ' . $ k . "( " . $ v . ")</a> | " ;
15061515 }
15071516 $ div = substr ( $ div , 0 , -3 );
15081517 $ div .= '</div> ' ;
@@ -1976,29 +1985,27 @@ function ptc_show_string(elId,link)
19761985 };
19771986 function ptc_show_trace(className,link)
19781987 {
1979- var elements= document.getElementsByClassName( \'\'+className+ \'\');
1980- for(i in elements)
1988+ var elements = document.getElementsByClassName( \'\'+className+ \'\');
1989+ for ( var i = 0; i < elements.length; i++ )
19811990 {
1982- if(elements[i].hasOwnProperty( \' style \' ) )
1991+ if(elements[i].style.display=="none" )
19831992 {
1984- if(elements[i].style.display=="none")
1985- {
1986- link.innerHTML=link.innerHTML.replace("\u21d3","\u21d1");
1987- elements[i].style.display= \'\';
1988- }
1989- else
1990- {
1991- link.innerHTML=link.innerHTML.replace("\u21d1","\u21d3");
1992- elements[i].style.display= \'none \';
1993- }
1993+ link.innerHTML=link.innerHTML.replace("\u21d3","\u21d1");
1994+ elements[i].style.display= \'\';
1995+ }
1996+ else
1997+ {
1998+ link.innerHTML=link.innerHTML.replace("\u21d1","\u21d3");
1999+ elements[i].style.display= \'none \';
19942000 }
19952001 }
19962002 };
19972003 function ptc_read_code(filename,line)
19982004 {
19992005 var query="http:// ' . addslashes ( $ _SERVER [ 'HTTP_HOST ' ] ) .
20002006 $ path = addslashes ( str_replace ( realpath ( $ _SERVER [ 'DOCUMENT_ROOT ' ] ) ,
2001- '' , realpath ( dirname ( __FILE__ ) ) ) ) . '/PtcDebug.php?ptc_read_file="+filename;
2007+ '' , realpath ( dirname ( __FILE__ ) ) ) ) . '/PtcDebug.php?session_name= ' .
2008+ session_name ( ) . '&ptc_read_file="+filename;
20022009 if(line){query+="&ptc_read_line="+line;}
20032010 newwindow=window.open(query,"name","height=350,width=820");
20042011 if(window.focus){newwindow.focus()};
@@ -2019,7 +2026,8 @@ function ptc_search_string( )
20192026 var query="http:// ' . addslashes ( $ _SERVER [ 'HTTP_HOST ' ] ) .
20202027 $ path = addslashes ( str_replace ( realpath ( $ _SERVER [ 'DOCUMENT_ROOT ' ] ) ,
20212028 '' , realpath ( dirname ( __FILE__ ) ) ) ) .
2022- '/PtcDebug.php?ptc_search_files="+document.getElementsByName("ptc_search_files")[0].value;
2029+ '/PtcDebug.php?session_name= ' . session_name ( ) .
2030+ '&ptc_search_files="+document.getElementsByName("ptc_search_files")[0].value;
20232031 query+="&ptc_search_path="+document.getElementsByName("ptc_search_path")[0].value;
20242032 newwindow=window.open(query,"name","height=350,width=1220");
20252033 if(window.focus){newwindow.focus()};
@@ -2225,8 +2233,9 @@ public static function showSearchPopup( $string , $path = null )
22252233 /**
22262234 * Calls highlight file method to show source code, session_start() must be active for security reasons
22272235 */
2228- if ( @ $ _GET [ 'ptc_read_file ' ] )
2236+ if ( isset ( $ _GET [ 'ptc_read_file ' ] ) )
22292237 {
2238+ session_name ( $ _GET [ 'session_name ' ] );
22302239 @session_start ( );
22312240 if ( !@$ _SESSION [ 'ptcdebug ' ][ 'code_highlighter ' ] ) { exit ( ); }
22322241 echo PtcDebug::highlightFile ( $ _GET [ 'ptc_read_file ' ] , @$ _GET [ 'ptc_read_line ' ] );
@@ -2235,8 +2244,9 @@ public static function showSearchPopup( $string , $path = null )
22352244 /**
22362245 * Shows a popup with string search results, session_start() must be active for security reasons
22372246 */
2238- if ( @ $ _GET [ 'ptc_search_files ' ] )
2247+ if ( isset ( $ _GET [ 'ptc_search_files ' ] ) )
22392248 {
2249+ session_name ( $ _GET [ 'session_name ' ] );
22402250 @session_start ( );
22412251 if ( !@$ _SESSION [ 'ptcdebug ' ][ 'search_files ' ] ) { exit ( ); }
22422252 echo PtcDebug::showSearchPopup ( $ _GET [ 'ptc_search_files ' ] , @$ _GET [ 'ptc_search_path ' ] );
0 commit comments