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

From: Date: Mon, 05 Aug 2019 15:55:07 +0000
Subject: Bug #78375 [NEW]: stream_set_option method of stream wrapper is now called inside require()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222092@lists.php.net to get a copy of this message
From:             mail at ciaranmcnulty dot com
Operating system: Debian Slim (docker)
PHP version:      7.4.0beta1
Package:          Streams related
Bug Type:         Bug
Bug description:stream_set_option method of stream wrapper is now called inside require()

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 bug report at https://bugs.php.net/bug.php?id=78375&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=78375&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=78375&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=78375&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=78375&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=78375&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=78375&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=78375&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=78375&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=78375&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=78375&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78375&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=78375&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=78375&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=78375&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=78375&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=78375&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=78375&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#222092) next »