@@ -189,33 +189,52 @@ function steevanb_dev_showCodePreview(id)
189189 */
190190 protected static function getBacktraceDump (array $ backtrace , $ index , $ previewPrefix )
191191 {
192+ $ filePath = null ;
193+ $ line = null ;
194+ $ previewId = $ previewPrefix . '_ ' . $ index ;
195+
192196 if (isset ($ backtrace ['file ' ])) {
193- $ file = basename ($ backtrace ['file ' ]);
194- $ filePath = $ backtrace ['file ' ];
195- $ fileFound = true ;
196- } else {
197- $ filePath = null ;
198- $ fileFound = false ;
199- }
197+ if (file_exists ($ backtrace ['file ' ])) {
198+ $ filePath = $ backtrace ['file ' ];
199+ $ fileFound = true ;
200200
201- if (isset ($ backtrace ['line ' ])) {
202- $ line = $ backtrace ['line ' ];
203- $ lineFound = true ;
201+ if (isset ($ backtrace ['line ' ])) {
202+ $ line = $ backtrace ['line ' ];
203+ $ lineFound = true ;
204+ } else {
205+ $ lineFound = false ;
206+ }
207+ } elseif (substr ($ backtrace ['file ' ], -16 ) === ' : eval() \'d code ' ) {
208+ $ fileAndLine = substr ($ backtrace ['file ' ], 0 , -16 );
209+ $ filePath = substr ($ fileAndLine , 0 , strrpos ($ fileAndLine , '( ' ));
210+ if (file_exists ($ filePath )) {
211+ $ line = substr ($ fileAndLine , strrpos ($ fileAndLine , '( ' ) + 1 , -1 );
212+ $ fileFound = true ;
213+ $ lineFound = true ;
214+ } else {
215+ $ fileFound = false ;
216+ $ lineFound = false ;
217+ }
218+ } else {
219+ $ fileFound = false ;
220+ $ lineFound = false ;
221+ }
204222 } else {
223+ $ fileFound = false ;
205224 $ lineFound = false ;
206225 }
207226
208227 if ($ fileFound === false && $ lineFound === false ) {
209228 $ fileLineHtml = '\Closure ' ;
229+ $ codePreview = null ;
210230 } else {
211- $ previewId = $ previewPrefix . '_ ' . $ index ;
212231 $ codePreview = static ::getCodePreview ($ filePath , $ line );
213232 $ fileLineHtml = '
214233 <a
215234 title=" ' . static ::getFilePath ($ filePath ) . '"
216235 onclick="steevanb_dev_showCodePreview( \'' . $ previewId . '\')"
217236 >
218- ' . $ file . ':: ' . $ line . '
237+ ' . basename ( $ filePath ) . ':: ' . $ line . '
219238 </a>
220239 ' ;
221240 }
0 commit comments