Re: PHP 7 : Cannot use stream wrappers during MINIT

From: Date: Sun, 08 Nov 2015 14:11:41 +0000
Subject: Re: PHP 7 : Cannot use stream wrappers during MINIT
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-89098@lists.php.net to get a copy of this message
It doesn't sound like what you are doing belongs in MINIT, it seems to belong in RINIT. MINIT is only for module setup with regard to zend (and other deps perhaps), but you are preparing for the user, that's request stuff I think ... Cheers Joe On Fri, Nov 6, 2015 at 12:08 AM, François Laupretre <francois@php.net> wrote: > Hi, > > First, I don't know if this must be considered as a bug, because a lot of > features are not available during MINIT but it seems quite inconsistent. I > precise I'm using the 7.x master branch (I don't know if it works on 5.x or > not). > > I am writing an extension where I need to read a file tree during the > MINIT phase. So, I am using php_stream_scandir() to read some directories.. > At this time, php_init_stream_wrappers() has run, so I consider stream > wrappers are available. > > Unfortunately, this is not true because stream wrappers register resources > in EG(regular_list), which is not initialized before init_compiler() has > run. If I call zend_hash_init(&(EG(regular_list))) before calling > php_stream_scandir(), it seems to works. But it is not the solution because > the hashtable is never destroyed and there are probably other side effects. > The same potentially applies to EG(persistent_list). > > So, does it mean that stream wrappers cannot be used during MINIT, or do > you know a workaround ? I can revert to the C stdio library but, for > portability reasons, I'd prefer using the plain wrapper. Every suggestion > is welcome. > > Another suggestion to help detecting such issues : can we consider, in > _zend_is_inconsistent(), that a HashTable whose nTableSize is null is > inconsistent and raises an alert. An uninitialized HashTable generally is > filled with 0s. Today, using an uninitialized HashTable goes undetected, > even in debug mode (because HT_OK == 0), and is very hard to track. > > Regards > > François > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#89098) next »