Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115937 Return-Path: <kevin@ie.suberic.net> Delivered-To: mailing list internals@lists.php.net Received: (qmail 38963 invoked from network); 3 Sep 2021 15:39:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Sep 2021 15:39:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DC9001804C9 for <internals@lists.php.net>; Fri, 3 Sep 2021 09:16:02 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: <kevin@ie.suberic.net> Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for <internals@lists.php.net>; Fri, 3 Sep 2021 09:16:02 -0700 (PDT) Received: by mail-pj1-f43.google.com with SMTP id i13so446082pjv.5 for <internals@lists.php.net>; Fri, 03 Sep 2021 09:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyda.ie; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=dXtW7zJUcJu90u5koLotguwxPtark34QYgnIzzwluhE=; b=Fio4fQWZ2unSJZhmuns23/qA5MLv5z/YHwO7D/GUw6zHixdxZYq6nD7KNMPYYT6443 wpLm4zy9YNtVzaAdv9FmhA87EP1dD3jg7Nt0fG2dwwAXcV9ih2neXpcKmpXgpEqmMj5N f4sMdd6Cz91uhQ/eSEOFBzxC3d9+/2dqp6rQ4nvg1M5QZUvy03TPvnOdkfobLKawexUX cj/BzfdDnEpXgaC8IZ0Irp4KjUKjk2BAPsYNXbuq0hXgl07W3AD7scaMhDUkwPb+X47v zggdqKGNUpaDSGdah9EtI1zJThRmc5/Qen+K/qoiOOOPcYKwc06JnALEx4RSJuwI4iUf XfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=dXtW7zJUcJu90u5koLotguwxPtark34QYgnIzzwluhE=; b=ZMiONCBRdv5JYTIrBIbX/nJbAJcyM0xs2gppXKK93zBSaAjeCa68Upp0GAYBmYd6gF MIxFjzeK/sDTw2h/HGLFffL5Qoyt6IOmOBa7iTIzN4/6ElFisAjo/aPs3jEktku/wasP fg04AP6eqbximkuzAHdDMMyEdPcUXuoSCSfBD68UyMny1a8+dd07z2gnbhraRlV7+MwV BrmsBRAbbBfepWBNa8zkOC6/B2rud3ji1Xy44r1Ay0I1XXxLOrBya+ynVOGToYvzU6Fc mRkK/tz8rSP9Xaq6hFKpLii8Hxe4s/SDee2yPgnitBRZBadBMJwUPk+cb1uKhEvvCwUV 1Rjw== X-Gm-Message-State: AOAM532M/MdMYK8LH0ybf/h/sfPMMhSClAGTF2NPrhRTcNj7L/T9nIT+ E6AcgF1erNU9c90z5vRiJbE9zdWPMcBoo92tEZBWHA== X-Google-Smtp-Source: ABdhPJwL7XYOWyQ5epigp6rnacrbiFnODAqe7/+7zC7R7Uoxa8semgeeBFh9B2PcDIkuCHay5xnIp5jWvPTetsIxzy8= X-Received: by 2002:a17:903:230b:b0:138:2913:1bc3 with SMTP id d11-20020a170903230b00b0013829131bc3mr3861074plh.44.1630685760300; Fri, 03 Sep 2021 09:16:00 -0700 (PDT) MIME-Version: 1.0 References: <CADJ56BRPi_GHE7R70k-NdgQ6ea2ogLSe6Z6Eg-YGKpeYSmvhbQ@mail.gmail.com> <CAJvSBVP2pCT6wDNrpVDp=1_JQtrG=H2Y2fy8L-vcvgawhWstCw@mail.gmail.com> <CADJ56BSHDTZ86oRqMHfsB860WXsO3ORv7JVGArJx+Q7FN4nD5g@mail.gmail.com> <0A048A30-444F-4DB0-A79C-9EA9BD07B1EC@cschneid.com> <CADJ56BT=TDF2_fn5ci-=34cuMSeks5NzA4r5_5acVNum9PY_kw@mail.gmail.com> <CAF+90c-qjOvu6UefGGba2NdRkhRovWq1sUCOfs6+Odt1eLJm+Q@mail.gmail.com> In-Reply-To: <CAF+90c-qjOvu6UefGGba2NdRkhRovWq1sUCOfs6+Odt1eLJm+Q@mail.gmail.com> Date: Fri, 3 Sep 2021 17:15:49 +0100 Message-ID: <CADJ56BRYYFx6w=88m+=XYX7xXNQR=N27DhE9q_3yKb2F2doTwQ@mail.gmail.com> To: Nikita Popov <nikita.ppv@gmail.com> Cc: Christian Schneider <cschneid@cschneid.com>, PHP internals <internals@lists.php.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Adding a way to disable the stat cache From: kevin@lyda.ie (Kevin Lyda) On Fri, Sep 3, 2021 at 4:24 PM Nikita Popov <nikita.ppv@gmail.com> wrote: > Just to throw it out there: Maybe we should clear the stat cache when fun= ctions in the exec family are used? Even if we allow disabling the stat cac= he, I think we can easily avoid that particular footgun. And if calls to ex= ternal binaries are involved we likely don't have to worry about stat overh= ead. This code also breaks: <?php $testfile=3D 'bug28790.write.out'; function print_stat($filename) { $s =3D @stat($filename); echo "$filename: ".$s['size']."\n"; } $f =3D fopen($testfile, "a"); print_stat($testfile); fwrite($f, "five\n"); print_stat($testfile); fclose($f); So you'd need to add fwrite and a number of other functions to the ones man= aging this cache. And after all that, external programs (or forked children) can ruin your day. One could argue that making a bug more arcane is a form of cruelty. Kevin