Hmm. So there is a different version of the patched file for each version of modx. So I assume we need to grab the specific class file for 2.2.10 pl2 and patch it. Then a different file for 2.2.11 pl2... that is how I was reading it.
If this is correct I am worried that a lot of people will miss-understand and try to patch all versions with the one class file from 2.2.13 or something. No idea what affect that may have. In which case it would perhaps have been nice to have a patch that would determine your version and patch with the correct version of the class file.
All that being said, it seems like we simply need to add the following 4 lines at the appropriate location in each of the modx.class.php files in each install. It may be faster to manually go through each installation and patch manually with these new lines.
if (!$this->context->validate()) {
$this->log(modX::LOG_LEVEL_ERROR, 'No valid context specified: ' . $contextKey);
$this->context = null;
}
e.g. find the _initContext function within core/model/modx/modx.class.php
protected function _initContext($contextKey, $regenerate = false, $options = null) {
$initialized= false;
$oldContext = is_object($this->context) ? $this->context->get('key') : '';
if (isset($this->contexts[$contextKey]) && $this->contexts[$contextKey] instanceof modContext) {
$this->context= & $this->contexts[$contextKey];
} else {
$this->context= $this->newObject('modContext');
$this->context->_fields['key']= $contextKey;
}
...
and change to
protected function _initContext($contextKey, $regenerate = false, $options = null) {
$initialized= false;
$oldContext = is_object($this->context) ? $this->context->get('key') : '';
if (isset($this->contexts[$contextKey]) && $this->contexts[$contextKey] instanceof modContext) {
$this->context= & $this->contexts[$contextKey];
} else {
$this->context= $this->newObject('modContext');
$this->context->_fields['key']= $contextKey;
if (!$this->context->validate()) {
$this->log(modX::LOG_LEVEL_ERROR, 'No valid context specified: ' . $contextKey);
$this->context = null;
}
}
...
Can someone please clarify this for us?
[ed. note: marcushouse last edited this post 12 years, 6 months ago.]