PhileCMS / Phile

A flat file CMS with a swappable parser and template engine.
https://philecms.github.io/
Other
257 stars 49 forks source link

Error when symlinking content directory #304

Closed breadcat closed 7 years ago

breadcat commented 7 years ago

Please report your issue with the following information:

Expected behavior

Page displays usual content when loaded

Actual behavior

Phile Logo
PhileCMS Development Error Handler
Error

Uncaught TypeError: Argument 1 passed to Phile\Plugin\Phile\TemplateTwig\Template\Twig::setCurrentPage() must be an instance of Phile\Model\Page, null given, called in /var/www/html/lib/Phile/Core.php on line 177 and defined in /var/www/html/plugins/phile/templateTwig/Classes/Template/Twig.php:56 Stack trace: #0 /var/www/html/lib/Phile/Core.php(177): Phile\Plugin\Phile\TemplateTwig\Template\Twig->setCurrentPage(NULL) #1 /var/www/html/lib/Phile/Core.php(71): Phile\Core->initializeTemplate() #2 /var/www/html/index.php(17): Phile\Core->__construct(Object(Phile\Core\Router), Object(Phile\Core\Response)) #3 {main} thrown [1]
triggered in file /var/www/html/plugins/phile/templateTwig/Classes/Template/Twig.php on line 56 .

/var/www/html/plugins/phile/templateTwig/Classes/Template/Twig.php:
00051:      * 
00052:      * @param Page $page the page model 
00053:      * 
00054:      * @return mixed|void 
00055:      */ 
00056:     public function setCurrentPage(Page $page) 
00057:     { 
00058:         $this->page = $page; 
00059:     } 
00060:  
00061:     /**

Steps to reproduce the behavior

$ ls -l content
drwxr-xr-x 3 name name   4096 May 10 13:48 content
$ mv content/ ~/sync/src/blog
$ ln -s ~/sync/src/blog content
$ ls -l content
lrwxrwxrwx 1 name name 25 May 10 14:05 content -> /home/name/sync/src/blog
$ ls -l content/
-rw-rw-rw- 1 name name   115 Apr 27  2016 404.md
-rw-rw-rw- 1 name name     0 Apr 27  2016 index.html
-rw-rw-rw- 1 name name 12655 Apr 27  2016 index.md
drwxrwxrwx 2 name name  4096 Apr 27  2016 sub

Additional information

I'm hosting this using the php:7.0-apache image via Docker on a fully updated Debian Stretch x86_64 install with an nginx reverse proxy.

reallyohwell commented 7 years ago

What you are doing should work, and is the obvious thing to do. But Phile is a bit tricky about using soft links to relocate the web page source code. See http://metasupes.com/blog/2016/2016-06-21 and the nearby posts.

breadcat commented 7 years ago

Not sure why, but this worked fine when I set it back up again different directory. Feel free to close the ticket.