We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Micro\Collection 502 Bad Gateway

i have a problem in php7 and phalcon 3 using Micro\Collection if i intend to put and error to my controller and access it through route it will return 502 Bad Gateway instead of error message on that file... in php5.6 and phalcon 2.0.x working fine...

Could you please share the code you used that raised the problem?

edited Jul '16

when i access the route with indetended error in my controller i get 502 bad gateway in $this->mount($collection); im using MacOs El Capitan with php7 and new phalcon 3.0... when i swtich to php5.6 and phalcon 2.0.x i can get the error message but in php7 i got 502 bad gateway

by the way i loop my route collection array and build Micro/Collection

    //set routes collection
    public function setRoutes($req) {

        $reqUri = $req;

        $getreqPrefix = explode('/', $reqUri);

        $collections = array();

        $collectionFiles = scandir($this->appDir . '/resources/routes');

        foreach($collectionFiles as $collectionFile){
            $pathinfo = pathinfo($collectionFile);

            if($pathinfo['extension'] === 'php'){

                $getcollection = include($this->appDir.'/resources/routes/'.$collectionFile);
                $prefixrplc =  str_replace('/', '',$getcollection['prefix']);

                if($prefixrplc == $getreqPrefix[1]){
                    $collections[] = $this->buildcollection($getcollection);
                }

            }
        }

        foreach($collections as $collection){
            $this->mount($collection);
        }

    }
    //end of setRoutes

    //build route collection
    private function buildcollection($route){

        $cltn = new Collection();

        $cltn->setPrefix($route['prefix'])
        ->setHandler($route['handler'])
        ->setLazy($route['lazy']);

        foreach($route['collection'] as $obj){

            if($obj['authentication']===false){

                $method = strtolower($obj['method']);

                if (!isset($this->_routeAllowed[$method])) {
                    $this->_routeAllowed[$method] = array();
                }
                $this->_routeAllowed[$method][] = $route['prefix'].$obj['route'];

            }

            $cltn->{$obj['method']}($obj['route'], $obj['function']);

        }

        return $cltn;

    }
    //end of buildcollection