Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: View: return value of getActiveRenderPath() | low priority #16614

Open
TerraTux opened this issue Jun 19, 2024 · 0 comments
Open

[BUG]: View: return value of getActiveRenderPath() | low priority #16614

TerraTux opened this issue Jun 19, 2024 · 0 comments
Labels
bug A bug report status: unverified Unverified

Comments

@TerraTux
Copy link

Describe the bug
If there's only one viewsDir and more than one renderEngines registered, then getActiveRenderPath() only returns the path with the extension of the first registered renderEngine.

To Reproduce

// during setup of the view service (simplified):

$view->setRenderPath([
    '/path/to/modules'
]);

$view->registerEngines([
    '.volt'     => $volt,       // Phalcon\Mvc\View\Engine\Volt
    '.phtml'    => $php         // Phalcon\Mvc\View\Engine\Php
]);
// ...

then when catching the view:notFoundView event:

public function notFoundView($event)
{
    $notFound = $event->getSource()->getActiveRenderPath();
    if (is_array($notFound))
    {
        // ...
    }

    // more dots...
}

But $notFound never is an array with such setup and only contains (string) '/path/to/modules/moduleName/views/missing_file.volt' while when dumping $view there are both absolute paths with each extension.

This behavior is very obvious in View.zep on Lines 337-341

Setting the renderPath twice to bypass this behavior also duplicates the activeRenderPaths

Expected behavior
getActiveRenderPath(): array|string should either really return all possible paths independend from the num of viewDirs, or could get a flag to return the protected variable as it is.

Details
Phalcon 5.6.1 on PHP 8.3.8

@TerraTux TerraTux added bug A bug report status: unverified Unverified labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: unverified Unverified
Projects
None yet
Development

No branches or pull requests

1 participant