Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89116 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95553 invoked from network); 9 Nov 2015 07:51:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Nov 2015 07:51:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.223.176 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.223.176 mail-io0-f176.google.com Received: from [209.85.223.176] ([209.85.223.176:34395] helo=mail-io0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/B0-06223-E7050465 for ; Mon, 09 Nov 2015 02:51:27 -0500 Received: by iody8 with SMTP id y8so177721482iod.1 for ; Sun, 08 Nov 2015 23:51:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zend_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=VAUGbRdbzwWHkN9GKRTd0w2CHUE+f2apxVx/iy0mLNE=; b=F+J67qFnKNNfOFWd2nuQLGmSa769GUCs+PdOtxq5MuPZwe70Eu/rbqOeRhP8/gwFFu iDASqIVkQ84Td+ci+E/fA7kxBZKOTYWGdz4CdtA0gzKL67vuODfb+R87+6RaIO9OWziC RqGiwKcPCeN0mtsawJFWsEsbGFMxhchWEfEr0S0Tv718lGmxVq9VNAq1jJwE2okk/aF3 neQy23gre8fZhJwVrUuM0xTdHisBFYkFLOizjJgJf4iuEwa5dHJgI6fsfvb4pbVDosDJ bTH07I0mfpHqA/xviuO0gl20M/L6I6t29YVDYUZZqXz1ceiRIIPhagfdxApluDo+X1vp 3/RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=VAUGbRdbzwWHkN9GKRTd0w2CHUE+f2apxVx/iy0mLNE=; b=dNwBFDhDfkI3A9kbqUl2IlqF7cJcBTOi6ljlz6jcyPl7oNCpNN6sVbrSnGiQ4aGWOY 9jU9JBkr4wqTTBnhuMXgydgDcHvh/3dm38cTJ+pUSSPGzKEzjaONrJdEk54ZNAPa2rWS FnXqpVwEbieyx8zLxIWJUgmDk/89dGJ5CdeVO49j5Grg9eGgGBiAxLSxGXQ2moNUxCqV 8WWrf2H9S147vr5C3LU8zdEf3wynLuSHKi8MMnypaYdGk9L0NGeSyc3g/OvBnphWZDIX gdyOMsd6+qzByena0ST4f3na+29Iuq2JJibTZgZiecJVKx6ZbGGCzIU8z4frubF5FHHy LECg== X-Gm-Message-State: ALoCoQmoStuMveqPwrYeXtavc8XRPn/h6VSInkW/9saMd2jaIw9sfSxDkEaZ36E7odiBXK/gvNgetiuM0oCkpjtdFwKfxFPEzGejGVcxxtuGWtUlsaG9TWdO9fGq4cKKcNLFYtjxXV9akhPNKujKXQIS2RLpFOKityJ89j5tJtidTk0y9OvvDG0= MIME-Version: 1.0 X-Received: by 10.107.15.17 with SMTP id x17mr24949185ioi.196.1447055483893; Sun, 08 Nov 2015 23:51:23 -0800 (PST) Received: by 10.50.73.166 with HTTP; Sun, 8 Nov 2015 23:51:23 -0800 (PST) In-Reply-To: <563BEF66.4050202@php.net> References: <563BEF66.4050202@php.net> Date: Mon, 9 Nov 2015 10:51:23 +0300 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: PHP internals Content-Type: multipart/alternative; boundary=001a113f1e2016d04a052416dc90 Subject: Re: PHP 7 : Cannot use stream wrappers during MINIT From: dmitry@zend.com (Dmitry Stogov) --001a113f1e2016d04a052416dc90 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Nov 6, 2015 at 3:08 AM, Fran=C3=A7ois Laupretre = 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). > MINIT wasn't designed to run any php code. You can't create objects and resources in this stage. > > 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 resource= s > 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 becau= se > the hashtable is never destroyed and there are probably other side effect= s. > 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. > It seems, you can't use wrappers. Probably, nobody tried this before :) You may try to use php_scandir() wrapper. > > 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 =3D=3D 0), and is very hard to track. > Uninitialized HashTables are not necessary filled with 0s. We can add more assert()s, but this is going to be a protection from our selves. Anyway, attempts of destruction of uninitialized HashTables most probably should lead to crash. Thanks. Dmitry. > > Regards > > Fran=C3=A7ois > --001a113f1e2016d04a052416dc90--