Closed Lacni135 closed 1 year ago
Hello, 👋
paths
is an array option:
Phug::setOptions([
'cache_dir' => '/var/cache/pug',
'paths' => [realpath(ROOT_DIR . '/public')],
'debug' => false
]);
Passing string to 'paths'
is not intended to work, please retry with the code above.
If it's still giving you an error please re-open this issue and post it here with the complete stack trace. 🙏
Thank you for the quick response :) The array for paths seems to have indeed fixed the problem. I have another kind of problem related to the cacheDirectory function (i can open another issue if you prefer).
Now when executing the function i get this error:
PHP Fatal error: Nesting level too deep - recursive dependency? in /var/www/pulsar-template/vendor/phug/phug/src/Phug/Event/EventManagerTrait.php on line 53
Changing the in_array() to add the $strict bool to true seems to fix the issue.
If this is sensitive to strictness of the in_array
, then some of the listener is likely not an object, maybe some false or null value sliced in there 🤔 Fishy. But anyway, I don't see any reason not to be strict for any of the in_array
in our project, I will strictify them all.
Thanks alot!
Hello,
I encountered an issue using the cacheDirectory() function.
I'm using this script to cache all pug file in my application (for production).
Some of the errors thrown.
PHP Fatal error: Uncaught TypeError: Phug\Renderer\Adapter\FileAdapter::locate(): Argument #2 ($locations) must be of type array, string given
PHP Fatal error: Uncaught TypeError: Phug\Compiler\Locator\FileLocator::locate(): Argument #2 ($locations) must be of type array, string given
Passing an array instead of a string to cacheDirectory() also gives typing errors.
To note, every pug files successfully compile and caches when the normal render runs with
up_to_date_check = true
Am I missing something?
Thanks!