todd, and the rest of you fellows:
Since I’ve written up this problem pretty heavily for the past six months, I spent another hour on it here, looking mainly at 2.2.0 and today’s 2.2.1 source code.
I think what’s getting confused here, and it seems to be in your language, is the distinction between Debug Preference in the CP; and the $config[‘debug’] setting in config.php.
These are two different settings completely, and only one affects the curly brackets, I am pretty sure.
- Debug Preference in the CP decides who may see debug messages. That will be Anyone (setting of 2), or Site Administrators Only (setting of 1)—again in the CP. The 2 setting is as it say, NOT SECURE, not for magical reasons but because someone could get a clue from things debug may output, like paths.
- $config[debug] = “N”; in system/expressionengine/config/config.php, on the other hand, decides what _kind_ of debug will show, when the setting above says it _may_ show. The value there can be “0”, “1”, or “2”.
“0”—show no debug of any kind. The purpose of this level is clearly to make a site look clean even if it isn’t. Not good, but a practical need once in a while. Particularly this might be appropriate if you have customers who have Admin Group logins, and you have a problem which lets the site work but is not quite fixed, like for example some cases where an add-on that isn’t updated yet.
The thing that’s broken so many person’s JavaScript/JSON code is that when $config[‘debug’] = 0; is set, there’s _also_ a filter set in EE that removes all code within curly brackets that hasn’t been recognized as a valid EE variable. And that’s what you’re seeing here.
“1”—this means show normal debug output, and _don’t_ crush unrecognized curly bracket content. Thus it’s actually a good setting, as long as you have a clean site free of bad EE variable indicators, or if your customer doesn’t have Admin logins, and you use the CP preference so that they don’t see any errors.
“2”—like “1”, but it also turns of database handling debugging. Probably needful only when developing database drivers, or in unusual circumstances.
All of this from the source, rather than the documentation, but the documentation says the same.
===
Now, I hope the above explanation makes things clearer, and of course I am hoping the understanding will help avoid any confusion on this curly bracket problem. If you set $config[debug] = 1; in config.php, and _still_ have any curly bracket issues, I think Ellis needs to hear that right away.
As a real solution, what I have asked them to do is to allow configuring the control that is already actually in the code, so that unrecognized curly bracket variables will never be removed when that control is set so. And, I have asked them to default that control’s setting so that curly brackets are not removed.
This simple arrangement should cleanly allow JavaScript blocks and JSON to operate fine always; and let you still use config[‘debug’] of zero if you really need to hide site quirks. And the old way (as now) would always be available for anyone who likes it.
The latest is that Pascal has indicated they will talk it over. That’s in the current bug report here (there have been lengthy others).
And I will add to it reference to this thread, so they can see if there’s anything unusual, or that the issues merge to be the same, as I believe, unless I am mistaken. This current bug starts out about elapsed_time being scrubbed in 2.2.0, but that’s to do with the same issue you have, as you’ll see, and this is what has got their attention on it.
Regards,
Clive