Concrete can't find single page in application folder

Permalink
Hi. I'm trying to add a single page to my site under sitename.com/index.php/singlepagetest. Documentation clearly says to put a php file inside application/single_pages directory yet when I do this navigating to this page results in an error message include(/PATH_TO_CONCRETE/www/concrete/single_pages/singlepagetest.php): failed to open stream: No such file or directory
So it appears it is looking inside concrete directory instead of application? If I put the file inside concrete/single_pages everything works fine.

 
hutman replied on at Permalink Reply
hutman
After you put the page into the single_pages directory, did you go to the Dashboard -> Pages & Themes -> Single Pages and add your single page to the list?
EugeneUNIWEB replied on at Permalink Reply
Yes, I did and it was added into the list of single pages. I can also see a corresponding record in Pages table in DB.
hutman replied on at Permalink Reply
hutman
What does the namespace at the top of your file look like? It should be

namespace Application\SinglePages;


If it wasn't that, or you don't have a namespace you need that and you will need to "refresh" your single page in the dashboard.
EugeneUNIWEB replied on at Permalink Reply
Looks like adding namespace and refreshing page in the list changes nothing, the error still persists. I've also cleared the cache from the dashboard and logged out.
hutman replied on at Permalink Reply
hutman
So you have a file named singlepagetest.php it the /application/single_pages directory, you have added singlepagetest to the Single Pages dashboard page, you have the namespace "namespace Application\SinglePages;" in your /application/single_pages/singlepagetest.php at the very top of the file, and you have cleared the cache?
EugeneUNIWEB replied on at Permalink Reply
Yes, I've checked all these points once again and the error is still there. If, however, the same file is put into concrete/single_pages folder page functions correctly.
hutman replied on at Permalink Reply
hutman
That file should not work in the /concrete directory if the namespace is correct.
EugeneUNIWEB replied on at Permalink Reply
<?php
namespace Application\SinglePages;

echo "printing this out of /NetBeansProjects/Ocms/www/concrete/single_pages/singlepagetest.php ";




This is verbatim the file that is located at /concrete/single_pages/, upon accessing mydomain.dev/index.php/singlepagetest I see the output, removing or renaming this file results in an error
EugeneUNIWEB replied on at Permalink Reply
I've managed to track down the source of the problem inside the CMS itself, inside the src/Foundation/Environment.php. Inside the method getRecord, where apparently overrides for resources are processed, $this->coreOverrides contains paths towards resources that are absolute (i.e. starting with /var/www...), meanwhile $segment contains relative paths which prevents the method from discovering that given segment is, in fact, contained in $this->coreOverrides. Patching the method so it appends DIR_APPLICATION in front of $segment when searching inside $this->coreOverrides solves the problem and CMS loads singlepagetest.php from the application folder like it's supposed to, yet it's unclear whether this is caused by some misconfiguration or is this a genuine bug?