[php-src] Issue #13777: Exclusive locks are not supported for this stream `php://stdout`

From: Date: Thu, 21 Mar 2024 16:36:56 +0000
Subject: [php-src] Issue #13777: Exclusive locks are not supported for this stream `php://stdout`
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246630@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13777 Author: staabm ### Description I wonder why the file_put_contents emitts a Exclusive locks are not supported for this stream error and putting the very same stream into stream_supports_lock does not return false, but also errors. The following code: ```php <?php var_dump(stream_supports_lock("php://stdout")); file_put_contents( "php://stdout", "x", FILE_APPEND | LOCK_EX, ); ``` Resulted in this output: ``` $ php test.php PHP Fatal error: Uncaught TypeError: stream_supports_lock(): Argument #1 ($stream) must be of type resource, string given in C:\dvl\Workspace\phpunit\test.php:3 Stack trace: #0 C:\dvl\Workspace\phpunit\test.php(3): stream_supports_lock() #1 {main} thrown in C:\dvl\Workspace\phpunit\test.php on line 3 Fatal error: Uncaught TypeError: stream_supports_lock(): Argument #1 ($stream) must be of type resource, string given in C:\dvl\Workspace\phpunit\test.php:3 Stack trace: #0 C:\dvl\Workspace\phpunit\test.php(3): stream_supports_lock() #1 {main} thrown in C:\dvl\Workspace\phpunit\test.php on line 3 ``` But I expected this output instead: ``` $ php test.php bool(false) PHP Warning: file_put_contents(): Exclusive locks are not supported for this stream in C:\dvl\Workspace\phpunit\test.php on line 5 Warning: file_put_contents(): Exclusive locks are not supported for this stream in C:\dvl\Workspace\phpunit\test.php on line 5 ``` might be a windows only error, because 3v4l.org does not report the same error https://3v4l.org/98p6T ### PHP Version PHP 8.2.12 ### Operating System windows11

« previous php.bugs (#246630) next »