|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-12-18 21:36 UTC] codeslinger at compsalot dot com
Description: ------------ Feature Request: the stream wrapper functions are *totally awesome* :-) !!! but the "stat" family of functions is limited by the lack of a "context" param. For instance I need to be able to provide a user name and password for a particular connection. for opendir mkdir fopen etc. I am able to pass a context with that info and everything works. But then when I try to do a "stat" or "fstat" it fails because there is no way to pass the $context. Thank you for making PHP such a fantastic programming language! Reproduce code: --------------- --- From manual page: streamwrapper.stream-stat#Description --- Actual result: -------------- also see related Bug #42965 copy() should support context parameters for URLs PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
And it seems that StreamWrapper stat doesn't use default context either. $options = array('testfs'=> array( 'storagePath'=>dirname(ROOTPATH).DIRECTORY_SEPARATOR.'storage' ) ); $defaultContext = stream_context_get_options(stream_context_get_default()); $newContext = array_replace_recursive($defaultContext, $options); stream_context_set_default($newContext); stream_wrapper_register('testfs', 'Test_StreamWrapper'); class Test_StreamWrapper { public $context; public function url_stat() { if($this->context === null) { print 'No Context!'; } return false; } } file_exists('testfs://foobar'); Expected: Got: No Context!