Re: declare(cache=0) - explanation (was: Re: [PHP-DEV] [mini-RFC] Disable opcache per script using "declare(cache=0)")

From: Date: Mon, 26 Nov 2018 10:46:59 +0000
Subject: Re: declare(cache=0) - explanation (was: Re: [PHP-DEV] [mini-RFC] Disable opcache per script using "declare(cache=0)")
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-103503@lists.php.net to get a copy of this message
On Mon, 26 Nov 2018 at 09:15, Zeev Suraski <vsuraski@gmail.com> wrote: > The goal of declare(cache=0) would be to avoid persisting utility > functions/classes that have to do with a particular preload.php > implementation - so that they don't become a part of the app's memory > context and 'pollute' its scope. > Thanks for the clarification, that makes a lot more sense than the performance impact. As I mentioned before, though, the behaviour of the following case is not obvious to me: # preload.php require 'foo.php'; require 'bar.php'; # foo.php declare(cache=0); class Foo {} # bar.php class Bar extends Foo {} At the time it is first parsed, Bar is a complete class, and is being defined during preload, so ought to be defined permanently; but it depends on Foo, which will not be cached. Will this be an error, or will class Bar simply not be defined on future requests? Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#103503) next »