Doc #78375 [Ver]: stream_set_option method of stream wrapper is now called inside require()

From: Date: Thu, 08 Aug 2019 08:20:38 +0000
Subject: Doc #78375 [Ver]: stream_set_option method of stream wrapper is now called inside require()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16867@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78375&edit=1 ID: 78375 Updated by: nikic@php.net Reported by: mail at ciaranmcnulty dot com Summary: stream_set_option method of stream wrapper is now called inside require() Status: Verified Type: Documentation Problem Package: Streams related Operating System: Debian Slim (docker) PHP Version: 7.4.0beta1 Block user comment: N Private report: N New Comment: Upgrading note added in https://github.com/php/php-src/commit/8a4171ac457c048e1b05b2d9fc9b74f4816272a0. I considered adding a special hack to hide the warning for this case, but overall I feel it would do more harm than good. Custom stream wrapper implementations aren't exactly super common, so I'd err on the side of consistent behavior here. Previous Comments: ------------------------------------------------------------------------ [2019-08-06 14:21:03] mail at ciaranmcnulty dot com This is indeed a docs problem! For some reason I hadn’t realised it is just a Warning ------------------------------------------------------------------------ [2019-08-05 17:15:38] cmb@php.net Well, this is a deliberate BC break caused by an optimization[1], and as such not a bug. However, this change is not documented in UPGRADING, and indeed PHP_STREAM_OPTION_READ_BUFFER (the option with value 2) is missing from the PHP manual. [1] <http://git.php.net/?p=php-src.git;a=commit;h=a986e70991057785cd3e5f4235215cb933351b4d> ------------------------------------------------------------------------ [2019-08-05 16:00:47] cmb@php.net Confirmed: <https://3v4l.org/QjgOW> ------------------------------------------------------------------------ [2019-08-05 15:55:07] mail at ciaranmcnulty dot com Description: ------------ Any require that is done through a protocol with a wrapper, now calls stream_set_option on the stream wrapper. Because a stream wrapper doesn't have an interface, a class could not yet implement this method and therefore cause a fatal error. The option being set is not one of the listed constants (STREAM_OPTION_BLOCKING, STREAM_OPTION_READ_TIMEOUT, STREAM_OPTION_WRITE_BUFFER), rather it is integer 2 Test script: --------------- class StreamWrapper { public function stream_open($path, $mode, $options, &$opened_path) { return true; } public function stream_stat() { return stat(__FILE__); } public function stream_read($count) { return ''; } public function stream_eof() { return true; } } stream_wrapper_register('test', StreamWrapper::class); require_once('test://foo'); Expected result: ---------------- No output Actual result: -------------- Warning: require_once(): StreamWrapper::stream_set_option is not implemented! ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78375&edit=1

« previous php.doc.bugs (#16867) next »