Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89091 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80349 invoked from network); 6 Nov 2015 00:08:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2015 00:08:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.6 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.6 smtp6-g21.free.fr Received: from [212.27.42.6] ([212.27.42.6:10980] helo=smtp6-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/48-24765-B6FEB365 for ; Thu, 05 Nov 2015 19:08:12 -0500 Received: from [127.0.0.1] (unknown [82.232.41.54]) (Authenticated sender: flaupretre@free.fr) by smtp6-g21.free.fr (Postfix) with ESMTPSA id 9096282211; Fri, 6 Nov 2015 00:58:36 +0100 (CET) To: PHP internals Cc: Dmitry Stogov Message-ID: <563BEF66.4050202@php.net> Date: Fri, 6 Nov 2015 01:08:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 151105-0, 05/11/2015), Outbound message X-Antivirus-Status: Clean Subject: PHP 7 : Cannot use stream wrappers during MINIT From: francois@php.net (=?UTF-8?Q?Fran=c3=a7ois_Laupretre?=) 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