- Issue created by @meladawy
The generateFromRequest
method in the FileNameGenerator
class of the ckeditor5_premium_features
module throws a warning: Undefined array key 1
. This issue occurs when the route name does not contain a dot (.), causing the explode('.', $route_name)
function to return an array with fewer than two elements. Consequently, attempting to access $route_param[1]
results in a PHP warning. This warning can cause unexpected behavior and errors when generating file names based on route and entity parameters.
protected_pages_login_page
.generateFromRequest
method in the context where this route name is active.Undefined array key 1 in FileNameGenerator->generateFromRequest()
.generateFromRequest
method to check if the $route_param
array has more than one element before attempting to access $route_param[1]
.public function generateFromRequest(): string { $route_name = $this->routeMatch->getRouteName(); $route_param = explode('.', $route_name); // Safely check if $route_param has enough elements if (count($route_param) > 1) { $entity = $this->routeMatch->getParameter($route_param[1]); } else { // Fallback if the route name doesn't contain a dot $entity = $this->routeMatch->getParameter('node'); // or use another default parameter } try { if ($entity) { $alias = $entity->toUrl()->toString(); return $this->convertUrlToFileName($alias); } } catch (\Exception $e) { // Handle exceptions if necessary } return self::DEFAULT_FILENAME; }
Active
1.3
Code