Req #80919 [NEW]: stream wrapper register first params prompt failed If underlined

From: Date: Tue, 30 Mar 2021 14:59:21 +0000
Subject: Req #80919 [NEW]: stream wrapper register first params prompt failed If underlined
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233067@lists.php.net to get a copy of this message
From:             352386674 at qq dot com
Operating system: Ubuntu PHP version 7.4.8(cli)
PHP version:      7.4.16
Package:          *Directory/Filesystem functions
Bug Type:         Feature/Change Request
Bug description:stream wrapper register first params  prompt failed If underlined

Description:
------------
<?php
  
class StreamDir
{
    public $context = NULL;
 
    public function dir_opendir(string $path, int $options)
    {
        return false;
    }
}
$wrapper_list = stream_get_wrappers();

if(in_array('diy', $wrapper_list))
{

    echo "stream wrapper already\n";

    exit(0);
}

stream_wrapper_register("dir", "StreamDir");

$context = stream_context_create(['dir' => []]);

$dir = opendir('dir://Directory path', $context);

var_dump($dir);

Test script:
---------------
<?php
  
class StreamDir
{
    public $context = NULL;
 
    public function dir_opendir(string $path, int $options)
    {
        return false;
    }
}
$wrapper_list = stream_get_wrappers();

if(in_array('diy_wrapper', $wrapper_list))
{

    echo "stream wrapper already\n";

    exit(0);
}

stream_wrapper_register("dir_wrapper", "StreamDir");

$context = stream_context_create(['dir_wrapper' => []]);

$dir = opendir('dir_wrapper://Directory path', $context);

var_dump($dir);


Expected result:
----------------
tips open directory failed

Actual result:
--------------
Warning: stream_wrapper_register(): Invalid protocol scheme specified.
Unable to register wrapper class StreamDir to dir_wrapper:// in PHP run
script path

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


Thread (4 messages)

« previous php.bugs (#233067) next »