Is modx 2.8.5 has newer API for php8?

just got the following in MODX Revolution 2.8.5-pl and php8…

Permission 'new_document' required for ''!{} Could not create resource: Permission 'new_document' required for ''!{}

this is happening in the code taken from

....// use the processor to create the resource - this does all sort of processing that we don't want to rewrite
   /** @var modProcessorResponse $response */
   $response = $modx->runProcessor('resource/create', [
       'context_key' => 'web',
       'parent' => $resourceParent,
       'template' => $resourceTemplate,
       'pagetitle' => $sourceRow['name'],
       'alias' => $modx->filterPathSegment($sourceRow['name'] . '-' . rand(0,999999)), // can leave this out or set a specific alias
       'published' => true,
   if ($response->isError()) {
       $errors = implode(', ', $response->getAllErrors());
       echo "Could not create resource: {$errors}{}\n";
   else {

But it works in php7.4. for sure… Is modx 2.8.5 has newer API for php8??

I use a similar import script with 2.8.5 and php8 and it works fine.

This sounds more like the user you are running this with does not have the required permissions set. How are you running your script? Within a snippet? Do you have a sudo user?

1 Like