After creating a resource in the manager via ’Create > Create a document here’ i get this error when saving that document:
’An error occurred while duplicating the resource.’
The error happens in the ’processors/resource/create.php’ where $search will be true
/* check new resource token if posted from manager */
if(isset($scriptProperties['create-resource-token'])) {
$tokenFound = false;
$tokenPassed = $scriptProperties['create-resource-token'];
$e = 'v';
if(!is_null($tokenPassed)) {
if(isset($_SESSION['newResourceTokens']) && !is_null($_SESSION['newResourceTokens'])) {
$search = array_search($tokenPassed, $_SESSION['newResourceTokens']);
if($search !== false) {
unset($_SESSION['newResourceTokens'][$search]);
$tokenFound = true;
}
}
}
if($tokenFound === false) {
return $modx->error->failure('- '.($e).' - '.$modx->lexicon('resource_err_duplicate'));
}
}
So the ’create-resource-token’ that is passed from the manager is found in the ’newResourceTokens’, which i’m thinking shouldn’t be the case. But then again i have no idea how they are generated and what they’re about.
But here is what i can say to narrow down the problem:
The error only happens when certain templates are involved (and these have a hand full or two of TVs, so i’m guessing it’s a TV thing?).
When i create a document and the new document either inherits a certain template from the parent or i set it with a plugin onDocFormPrerender, that document can not be saved (and actually be created) but gives the error message.
Anybody who has deeper understanding of these new token thingies has an idea if this might be a bug?
I will make more experiments with the TVs involved, but maybe someone can point me in a direction before i keep poking around in the dark.
Thanks,
Marc