File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1275,17 +1275,15 @@ private function runTest(): mixed
1275
1275
if ($ this ->expectErrorLog ) {
1276
1276
$ this ->assertNotEmpty ($ errorLogOutput , 'Test did not call error_log(). ' );
1277
1277
} else {
1278
- // strip date from logged error, see https://github.com/php/php-src/blob/c696087e323263e941774ebbf902ac249774ec9f/main/main.c#L905
1279
- print preg_replace ('/\[.+\] / ' , '' , $ errorLogOutput );
1278
+ print $ this ->stripDateFromErrorLog ($ errorLogOutput );
1280
1279
}
1281
1280
}
1282
1281
} catch (Throwable $ exception ) {
1283
1282
if ($ capture !== false ) {
1284
1283
if (!$ this ->expectErrorLog ) {
1285
1284
$ errorLogOutput = stream_get_contents ($ capture );
1286
1285
1287
- // strip date from logged error, see https://github.com/php/php-src/blob/c696087e323263e941774ebbf902ac249774ec9f/main/main.c#L905
1288
- print preg_replace ('/\[.+\] / ' , '' , $ errorLogOutput );
1286
+ print $ this ->stripDateFromErrorLog ($ errorLogOutput );
1289
1287
}
1290
1288
}
1291
1289
@@ -1310,6 +1308,12 @@ private function runTest(): mixed
1310
1308
return $ testResult ;
1311
1309
}
1312
1310
1311
+ private function stripDateFromErrorLog (string $ log ): string
1312
+ {
1313
+ // https://github.com/php/php-src/blob/c696087e323263e941774ebbf902ac249774ec9f/main/main.c#L905
1314
+ return preg_replace ('/\[\d+-\w+-\d+ \d+:\d+:\d+ [^\r\n[\]]+?\] / ' , '' , $ log );
1315
+ }
1316
+
1313
1317
/**
1314
1318
* @throws ExpectationFailedException
1315
1319
*/
You can’t perform that action at this time.
0 commit comments