@@ -104,22 +104,25 @@ public function setFiles(int $current, int $limit = 20)
104
104
105
105
// Get the contents of this specific history request
106
106
$ contents = file_get_contents ($ filename );
107
- $ contents = json_decode ($ contents );
108
-
109
- \preg_match_all ('/\d+/ ' , $ filename , $ time );
110
- $ time = (int )$ time [0 ][0 ];
111
-
112
- // Debugbar files shown in History Collector
113
- $ files [] = [
114
- 'time ' => $ time ,
115
- 'datetime ' => date ('Y-m-d H:i:s ' , $ time ),
116
- 'active ' => $ time === $ current ,
117
- 'status ' => $ contents ->vars ->response ->statusCode ,
118
- 'method ' => $ contents ->method ,
119
- 'url ' => $ contents ->url ,
120
- 'isAJAX ' => $ contents ->isAJAX ? 'Yes ' : 'No ' ,
121
- 'contentType ' => $ contents ->vars ->response ->contentType ,
122
- ];
107
+
108
+ $ contents = @json_decode ($ contents );
109
+ if (json_last_error () === JSON_ERROR_NONE )
110
+ {
111
+ preg_match_all ('/\d+/ ' , $ filename , $ time );
112
+ $ time = (int )$ time [0 ][0 ];
113
+
114
+ // Debugbar files shown in History Collector
115
+ $ files [] = [
116
+ 'time ' => $ time ,
117
+ 'datetime ' => date ('Y-m-d H:i:s ' , $ time ),
118
+ 'active ' => $ time === $ current ,
119
+ 'status ' => $ contents ->vars ->response ->statusCode ,
120
+ 'method ' => $ contents ->method ,
121
+ 'url ' => $ contents ->url ,
122
+ 'isAJAX ' => $ contents ->isAJAX ? 'Yes ' : 'No ' ,
123
+ 'contentType ' => $ contents ->vars ->response ->contentType ,
124
+ ];
125
+ }
123
126
}
124
127
125
128
$ this ->files = $ files ;
0 commit comments