@@ -2321,64 +2321,81 @@ private function startErrorLogCapture(): void
2321
2321
2322
2322
$ errorLogCapture = tmpfile ();
2323
2323
2324
- if ($ errorLogCapture !== false ) {
2325
- $ capturePath = stream_get_meta_data ($ errorLogCapture )['uri ' ];
2324
+ if ($ errorLogCapture === false ) {
2325
+ return ;
2326
+ }
2326
2327
2327
- if (@is_writable ($ capturePath )) {
2328
- $ this ->previousErrorLogTarget = ini_set ('error_log ' , $ capturePath );
2329
- } else {
2330
- $ errorLogCapture = false ;
2331
- }
2328
+ $ capturePath = stream_get_meta_data ($ errorLogCapture )['uri ' ];
2329
+
2330
+ if (!@is_writable ($ capturePath )) {
2331
+ return ;
2332
2332
}
2333
2333
2334
- $ this ->errorLogCapture = $ errorLogCapture ;
2334
+ $ this ->errorLogCapture = $ errorLogCapture ;
2335
+ $ this ->previousErrorLogTarget = ini_set ('error_log ' , $ capturePath );
2335
2336
}
2336
2337
2337
2338
private function verifyErrorLogExpectation (): void
2338
2339
{
2339
- if ($ this ->errorLogCapture !== false ) {
2340
- $ errorLogOutput = stream_get_contents ($ this ->errorLogCapture );
2341
-
2340
+ if ($ this ->errorLogCapture === false ) {
2342
2341
if ($ this ->expectErrorLog ) {
2343
- $ this ->assertNotEmpty ($ errorLogOutput , 'Test did not call error_log(). ' );
2344
- } else {
2345
- if ($ errorLogOutput !== false ) {
2346
- print $ this ->stripDateFromErrorLog ($ errorLogOutput );
2347
- }
2342
+ $ this ->markTestIncomplete ('Could not create writable error_log file. ' );
2348
2343
}
2349
- } elseif ($ this ->expectErrorLog ) {
2350
- $ this ->markTestIncomplete ('Could not create writable error_log file. ' );
2344
+
2345
+ return ;
2346
+ }
2347
+
2348
+ $ errorLogOutput = stream_get_contents ($ this ->errorLogCapture );
2349
+
2350
+ if ($ this ->expectErrorLog ) {
2351
+ $ this ->assertNotEmpty ($ errorLogOutput , 'Test did not call error_log(). ' );
2352
+
2353
+ return ;
2354
+ }
2355
+
2356
+ if ($ errorLogOutput === false ) {
2357
+ return ;
2351
2358
}
2359
+
2360
+ print $ this ->stripDateFromErrorLog ($ errorLogOutput );
2352
2361
}
2353
2362
2354
2363
private function handleErrorLogError (): void
2355
2364
{
2356
- if ($ this ->errorLogCapture ! == false ) {
2357
- if (! $ this -> expectErrorLog ) {
2358
- $ errorLogOutput = stream_get_contents ( $ this -> errorLogCapture );
2365
+ if ($ this ->errorLogCapture = == false ) {
2366
+ return ;
2367
+ }
2359
2368
2360
- if ($ errorLogOutput !== false ) {
2361
- print $ this ->stripDateFromErrorLog ($ errorLogOutput );
2362
- }
2363
- }
2369
+ if ($ this ->expectErrorLog ) {
2370
+ return ;
2371
+ }
2372
+
2373
+ $ errorLogOutput = stream_get_contents ($ this ->errorLogCapture );
2374
+
2375
+ if ($ errorLogOutput !== false ) {
2376
+ print $ this ->stripDateFromErrorLog ($ errorLogOutput );
2364
2377
}
2365
2378
}
2366
2379
2367
2380
private function stopErrorLogCapture (): void
2368
2381
{
2369
- if ($ this ->errorLogCapture !== false ) {
2370
- ShutdownHandler::resetMessage ();
2382
+ if ($ this ->errorLogCapture === false ) {
2383
+ return ;
2384
+ }
2371
2385
2372
- fclose ( $ this -> errorLogCapture );
2386
+ ShutdownHandler:: resetMessage ( );
2373
2387
2374
- $ this ->errorLogCapture = false ;
2388
+ fclose ( $ this ->errorLogCapture ) ;
2375
2389
2376
- if ($ this ->previousErrorLogTarget !== false ) {
2377
- ini_set ('error_log ' , $ this ->previousErrorLogTarget );
2390
+ $ this ->errorLogCapture = false ;
2378
2391
2379
- $ this ->previousErrorLogTarget = false ;
2380
- }
2392
+ if ( $ this ->previousErrorLogTarget === false ) {
2393
+ return ;
2381
2394
}
2395
+
2396
+ ini_set ('error_log ' , $ this ->previousErrorLogTarget );
2397
+
2398
+ $ this ->previousErrorLogTarget = false ;
2382
2399
}
2383
2400
2384
2401
/**
0 commit comments