Okay, perhaps I'm just going mad. I thought `PROTE...
# lucee
a
Okay, perhaps I'm just going mad. I thought
PROTECTED
was a private scope for components and our Adobe CF and Lucee 4.x/5.x code is enthusiastically accepting our use of this scope but I can't find any documentation anywhere in the world that acknowledges this scope as a thing that exists. Can anyone tell me what I've done here?
z
image.png
never heard of a protected scope, this setting lets you change the default behavior of all this properties being accessible
a
Okay, but I've got this and it... works?
Copy code
<cfcomponent output="false">
	<cffunction name="init">
		<cfset PROTECTED.SomeRedactedThing = '[nope]';
		<cfreturn this>
	</cffunction>
...
Everything in the component can touch that scope like it's a sensible and unexceptional thing to be doing, and as near as I can tell it's not some weird thing being set up by a super-class.
Does this not actually exist-- oh my goodness it doesn't actually exist.
I thought you had to set variables up as structs before you could refer to them.
But you don't, do you. So that object is just lurking in the... THIS scope? And being found by Lucee scope searching.
d
It'd be my guess that it is dropping into the variables scope.
as variables.PROTECTED.SomeRedactedThing
however, i looked again and it is a component, so let's let someone else answer 😉
a
Okay. Sure. We've just hallucinated a scope for 15 years. This is fine. Thank you very much.
That's not sarcastic, either, because it's clear we've actually done that.
z
i only learnt about the option in the screenshot due to a regression! https://luceeserver.atlassian.net/browse/LDEV-4930
@David Johnson you are correct, by default anything unscoped in a component ends up in the variables scope
lucee has options to turn all this cfml sillyness off, but they are all disabled by default for compat reasons
b
yeah, that's just like how people used to use
Copy code
instance.foo = "bar"
in the day to pretend they were java devs or something. But it was just
variables.instance.foo
all along.