wazum / sluggi

The TYPO3 CMS slug helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception thrown when a sysfolder on root level is renamed

subnoodle opened this issue · comments

Dear Wolfgang,

i found a little bug today in ext::sluggi.

First of all: I wonder if - hopefully - typo3 takes your extension into the core! Why does this not work out of the box what your extension does like a charm!

The error occurs when

  • having a sysfolder on root level
  • sysfolder is not a root-page
  • sysfolder has a slug (is not "/")
  • you want to rename the sysfolder

There is the exception:

`(1/1) #1521716622 TYPO3\CMS\Core\Exception\SiteNotFoundException
No site found in root line of page 8

in /html/site/public/typo3/sysext/core/Classes/Site/SiteFinder.php line 135
if (isset($this->mappingRootPageIdToIdentifier[(int)$pageInRootLine['uid']])) {
return $this->sites[$this->mappingRootPageIdToIdentifier[(int)$pageInRootLine['uid']]];
}
}
throw new SiteNotFoundException('No site found in root line of page ' . $pageId, 1521716622);
}

/**
 * @param bool $useCache

at TYPO3\CMS\Core\Site\SiteFinder->getSiteByPageId(8)
in /html/site/public/typo3/sysext/redirects/Classes/Service/SlugService.php line 140
}

protected function initializeSettings(int $pageId): void
{
    $this->site = $this->siteFinder->getSiteByPageId($pageId);
    $settings = $this->site->getConfiguration()['settings']['redirects'] ?? [];
    $this->autoUpdateSlugs = $settings['autoUpdateSlugs'] ?? true;
    $this->autoCreateRedirects = $settings['autoCreateRedirects'] ?? true;
    if (!$this->context->getPropertyFromAspect('workspace', 'isLive')) {

at TYPO3\CMS\Redirects\Service\SlugService->initializeSettings(8)
in /html/site/public/typo3conf/ext/sluggi/Classes/Backend/Service/SlugService.php line 44
protected $redirectKeepQueryParameters;

protected function initializeSettings(int $pageId): void
{
    parent::initializeSettings($pageId);

    $settings = $this->site->getConfiguration()['settings']['redirects'] ?? [];
    $this->redirectForceHttps = (int)($settings['forceHttps'] ?? 0);
    $this->redirectRespectQueryParameters = (int)($settings['respectQueryParameters'] ?? 0);

at Wazum\Sluggi\Backend\Service\SlugService->initializeSettings(8)
in /html/site/public/typo3conf/ext/sluggi/Classes/Backend/Service/SlugService.php line 62
$currentPageRecord = BackendUtility::getRecord('pages', $pageId);
if ($currentPageRecord === null) {
return;
}
$this->initializeSettings($pageId);
if ($this->autoUpdateSlugs || $this->autoCreateRedirects) {
$this->createCorrelationIds($pageId, $correlationId);
if ($this->autoCreateRedirects) {
$this->createRedirectWithPageId(
at Wazum\Sluggi\Backend\Service\SlugService->rebuildSlugsForSlugChange(8, '/footer-navigation', '/', object(TYPO3\CMS\Core\DataHandling\Model\CorrelationId))
in /html/site/public/typo3/sysext/redirects/Classes/Hooks/DataHandlerSlugUpdateHook.php line 102
) {
return;
}

    $this->slugService->rebuildSlugsForSlugChange($id, $persistedSlugValue, $fieldArray['slug'], $dataHandler->getCorrelationId());
}

/**
 * Determines whether our identifier is part of correlation id aspects.

at TYPO3\CMS\Redirects\Hooks\DataHandlerSlugUpdateHook->processDatamap_postProcessFieldArray('update', 'pages', 8, array('title' => 'Footer navigation xx', 'slug' => '/', 'tx_sluggi_sync' => '1', 'tstamp' => 1612275261, 't3ver_stage' => 0), object(TYPO3\CMS\Core\DataHandling\DataHandler))
in /html/site/public/typo3/sysext/core/Classes/DataHandling/DataHandler.php line 1172
}
// Hook: processDatamap_postProcessFieldArray
foreach ($hookObjectsArr as $hookObj) {
if (method_exists($hookObj, 'processDatamap_postProcessFieldArray')) {
$hookObj->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $this);
}
}
// Performing insert/update. If fieldArray has been unset by some userfunction (see hook above), don't do anything
// Kasper: Unsetting the fieldArray is dangerous; MM relations might be saved already
at TYPO3\CMS\Core\DataHandling\DataHandler->process_datamap()
in /html/site/public/typo3/sysext/backend/Classes/Controller/EditDocumentController.php line 559
}

    // Perform the saving operation with DataHandler:
    if ($this->doSave === true) {
        $tce->process_datamap();
        $tce->process_cmdmap();
    }
    // If pages are being edited, we set an instruction about updating the page tree after this operation.
    if ($tce->pagetreeNeedsRefresh

at TYPO3\CMS\Backend\Controller\EditDocumentController->processData(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Controller/EditDocumentController.php line 419
|| isset($parsedBody['_savedokview'])
|| isset($parsedBody['_savedoknew'])
|| isset($parsedBody['_duplicatedoc'])
) {
if ($response = $this->processData($request)) {
return $response;
}
}

at TYPO3\CMS\Backend\Controller\EditDocumentController->mainAction(object(TYPO3\CMS\Core\Http\ServerRequest))
at call_user_func_array(array(object(TYPO3\CMS\Backend\Controller\EditDocumentController), 'mainAction'), array(object(TYPO3\CMS\Core\Http\ServerRequest)))
in /html/site/public/typo3/sysext/backend/Classes/Http/RouteDispatcher.php line 66
}
$targetIdentifier = $route->getOption('target');
$target = $this->getCallableFromTarget($targetIdentifier);
$arguments = [$request];
return call_user_func_array($target, $arguments);
}

/**
 * Wrapper method for static form protection utility

at TYPO3\CMS\Backend\Http\RouteDispatcher->dispatch(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Http/RequestHandler.php line 94
// there are Core classes that need the Request object but do not get it handed in
$this->resetGlobalsToCurrentRequest($request);
try {
// Check if the router has the available route and dispatch.
return $this->dispatcher->dispatch($request);
} catch (InvalidRequestTokenException $e) {
// When token was invalid redirect to login
$loginPage = GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute('login');
return new RedirectResponse((string)$loginPage);
at TYPO3\CMS\Backend\Http\RequestHandler->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/extbase/Classes/Middleware/SignalSlotDeprecator.php line 49
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$this->dispatcher->reportDeprecatedSignalSlots();
return $handler->handle($request);
}
}
at TYPO3\CMS\Extbase\Middleware\SignalSlotDeprecator->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(TYPO3\CMS\Backend\Http\RequestHandler))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Middleware/SiteResolver.php line 69
}
$site = $this->siteMatcher->matchByPageId($pageId, $rootLine);
$request = $request->withAttribute('site', $site);
}
return $handler->handle($request);
}
}
at TYPO3\CMS\Backend\Middleware\SiteResolver->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Middleware/AdditionalResponseHeaders.php line 41
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
foreach ($GLOBALS['TYPO3_CONF_VARS']['BE']['HTTP']['Response']['Headers'] ?? [] as $header) {
[$headerName, $value] = explode(':', $header, 2);
$response = $response->withAddedHeader($headerName, trim($value));
}
at TYPO3\CMS\Backend\Middleware\AdditionalResponseHeaders->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Middleware/OutputCompression.php line 47
ob_clean();
// Initialize output compression if configured
$this->initializeOutputCompression();

    return $handler->handle($request);
}

/**
 * Initialize output compression if configured

at TYPO3\CMS\Backend\Middleware\OutputCompression->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Middleware/BackendUserAuthenticator.php line 78
$GLOBALS['LANG'] = LanguageService::createFromUserPreferences($GLOBALS['BE_USER']);
// Re-setting the user and take the workspace from the user object now
$this->setBackendUserAspect($GLOBALS['BE_USER']);

    $response = $handler->handle($request);

    // If no backend user is logged-in, the cookie should be removed
    if (!GeneralUtility::makeInstance(Context::class)->getAspect('backend.user')->isLoggedIn()) {
        $GLOBALS['BE_USER']->removeCookie($GLOBALS['BE_USER']->name);

at TYPO3\CMS\Backend\Middleware\BackendUserAuthenticator->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Middleware/BackendRouteInitialization.php line 58

    // Add the route path to the request
    $request = $request->withAttribute('routePath', $pathToRoute);

    return $handler->handle($request);
}

}
at TYPO3\CMS\Backend\Middleware\BackendRouteInitialization->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Middleware/ForcedHttpsBackendRedirector.php line 55
[$server, $address] = explode('/', $url, 2);
return new RedirectResponse('https://' . $server . $sslPortSuffix . '/' . $address);
}

    return $handler->handle($request);
}

}
at TYPO3\CMS\Backend\Middleware\ForcedHttpsBackendRedirector->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Middleware/LockedBackendGuard.php line 73
$request->getAttribute('normalizedParams')->getRemoteAddress(),
trim((string)$GLOBALS['TYPO3_CONF_VARS']['BE']['IPmaskList'])
);

    return $handler->handle($request);
}

/**
 * Check adminOnly configuration variable and redirects to an URL in file typo3conf/LOCK_BACKEND

at TYPO3\CMS\Backend\Middleware\LockedBackendGuard->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php line 45
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request));
return $handler->handle($request);
}
}
at TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172

            if (!$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342);
            }
            return $middleware->process($request, $this->next);
        }
    };
}

}
at class@anonymous/html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f24dfd1b41b->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 78
* @return ResponseInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
return $this->tip->handle($request);
}

/**
 * Seed the middleware stack with the inner request handler

at TYPO3\CMS\Core\Http\MiddlewareDispatcher->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/core/Classes/Http/AbstractApplication.php line 85
* @return ResponseInterface
*/
protected function handle(ServerRequestInterface $request): ResponseInterface
{
return $this->requestHandler->handle($request);
}

/**
 * Set up the application and shut it down afterwards

at TYPO3\CMS\Core\Http\AbstractApplication->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/backend/Classes/Http/Application.php line 72
$request = $request->withAttribute('applicationType', $applicationType);

    // Set up the initial context
    $this->initializeContext();
    return parent::handle($request);
}

/**
 * Check if LocalConfiguration.php and PackageStates.php exist

at TYPO3\CMS\Backend\Http\Application->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/site/public/typo3/sysext/core/Classes/Http/AbstractApplication.php line 97
final public function run(callable $execute = null)
{
try {
$response = $this->handle(
ServerRequestFactory::fromGlobals()
);
if ($execute !== null) {
call_user_func($execute);
}
at TYPO3\CMS\Core\Http\AbstractApplication->run()
in /html/site/public/typo3/index.php line 25
// Set up the application for the backend
call_user_func(function () {
$classLoader = require dirname(dirname(DIR)).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader)->get(\TYPO3\CMS\Backend\Http\Application::class)->run();
});
at {closure}()
in /html/site/public/typo3/index.php line 26
call_user_func(function () {
$classLoader = require dirname(dirname(DIR)).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader)->get(\TYPO3\CMS\Backend\Http\Application::class)->run();
});`

@subnoodle thanks for reporting this issue, I'll take a look at it tomorrow