Error 10 on get collection

Permalink
Hi!

I have a page not found error when try to access every page of a website.

On concrete/dispatcher.php, line 162 we have a $c->isError(), I test and it returns the number 10. When remove this code, the page self-reload forever:
if ($c->isError()) {
         // if we've gotten an error getting information about this particular collection
         // than we load up the Content class, and get prepared to fire away
         switch($c->getError()) {
            case COLLECTION_NOT_FOUND:
               $v = View::getInstance();
               $v->render('/page_not_found');
               break;
         }
      }


I clear the cache manually on files/cache.

What is that error? Do someone know to fix it?

Thank you!

alexlana
 
alexlana replied on at Permalink Reply
alexlana
When I print_r($c), I get this:

Page Object
(
[blocksAliasedFromMasterCollection:protected] =>
[cID] =>
[attributes:protected] => Array
(
)

[error] => 10
)
maggiew replied on at Permalink Reply
I'm seeing the same issue. As a result, the script breaks at this point and none of the rest of what's in dispatcher.php executes. Does anyone know the cause / how to fix this? Thanks.
alexlana replied on at Permalink Reply
alexlana
I found the error, but not the solution yet. On concrete/core/libraries/request.php, line 110, we have this:
if (defined('SERVER_PATH_VARIABLE')) {
            $path = Request::parsePathFromRequest(SERVER_PATH_VARIABLE);
         }
         if (!$path) {
            $path = Request::parsePathFromRequest('PATH_INFO');
         }
         if (!$path) {
            $path = Request::parsePathFromRequest('REDIRECT_URL');
         }
         if (!$path) {
            $path = Request::parsePathFromRequest('REQUEST_URI');
         }
         if (!$path) {
            $path = Request::parsePathFromRequest('ORIG_PATH_INFO');
         }


Godaddy Server does not return PATH_INFO and return REDIRECT_URL with an additional ~/accountname before the Concrete5 path...

If someone know how to fix it, please, tell me! :)
melat0nin replied on at Permalink Reply
melat0nin
I had a similar problem when trying to access a collection like this:

$page = Page::getByID( $c->getAttribute('related_page') );


The problem seemed to be that the attribute related_page was a string, which meant that it getByID() didn't fetch the right object (who knows what object it actually fetched -- probably an error page of some sort).

Anyway, by casting the value given to getByID() as an integer the problem was solved for me:

$page = Page::getByID( (int)$c->getAttribute('related_page') );