Skip to content

fwrite to php://stderr throws E_NOTICE on php 7.4 #420

@miranovy

Description

@miranovy

Version: 2.3.2

Bug Description

Function fwrite to php://stderr throws E_NOTICE on php 7.4. On php 7.3 and 7.2 behaves correctly.

Steps To Reproduce

<?php declare(strict_types=1);

namespace Tests;

use Tester\Assert;
use Tester\TestCase;

$container = require __DIR__ . '/../bootstrap.php';

class FwriteTest extends TestCase
{
    public function testPhpStderr()
    {
	$fw = fopen('php://stderr', 'w');
	fwrite($fw, 'same text');
	fclose($fw);
    }
}

(new FwriteTest())->run();
vendor/bin/tester -s -p php --colors 1 -C fwrite.phpt 
 _____ ___  ___ _____ ___  ___
|_   _/ __)( __/_   _/ __)| _ )
  |_| \___ /___) |_| \___ |_|_\  v2.3.2

PHP 7.4.7 (cli) | php | 8 threads

F

-- FAILED: fwrite.phpt
   Exited with error code 255 (expected 0)
   E_NOTICE: fwrite(): write of 5 bytes failed with errno=32 Broken pipe
   
   in tests/Logger/fwrite.phpt(16) 
   in [internal function]Tester\TestCase->Tester\{closure}()
   in tests/Logger/fwrite.phpt(16) fwrite()
   in src/Framework/TestCase.php(143) Tests\FwriteTest->testPhpStderr()
   in src/Framework/TestCase.php(55) Tester\TestCase->runTest()
   in tests/Logger/fwrite.phpt(22) Tester\TestCase->run()


FAILURES! (1 test, 1 failure, 0.1 seconds)

Run test separately via php fwrite.phpt behaves as expected.

same text
Error: This test forgets to execute an assertion.

Expected Behavior

Write text to stderr, same as run test separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions