Hi Larry, Côme, Thanks for pressing on this; I'd rather fix it in the RFC than find it in the vote.
One clarification first, because I think it narrows the problem: a scope only affects the code that runs inside it, and the only one who can run your function inside a scope is a caller of yours. That caller can already clear $_GET before calling you and restore it after, or change the default timezone for the duration of the call. A scope gives them nothing they could not do today, except that what the inner code changes cannot leak back out. So "someone created a scope 40 calls up the stack" has the same blast radius as "someone cleared the superglobals 40 calls up the stack": a bug in that caller, not a new way for code to run with state it was not given. What that leaves, and what I take from both of you, is that there are two reasons to create a scope and the RFC only serves one. A server creates a scope to start a new unit of work, and there starting empty is right. A test, a plugin host or a sandbox creates a scope to guard the current state from the inner code, and there the inner code should see what the creator sees, now and after any later RFC adds to what follows the scope. I intend to add that second case: a scope that starts as a copy of its creator's request arrays and current locale and timezone, so that code which guards inherits, and a later move changes only what "fresh" means, which concerns the servers. Before I write it up I'd like your view on the shape of it. Should inherit be the default of new Scope(), with the servers asking explicitly for a fresh one, or the other way around? Is a shallow copy of the arrays what you'd expect, or should the inherited scope share them with its creator? And is there anything else in the "missing ambient state" category that you'd want covered by the same rule? Best regards, Frode Børli
