I previously posted this about the bug, I reported it as a bug against 1.3 https://github.com/phalcon/cphalcon/issues/3274 and made this PR: https://github.com/phalcon/cphalcon/pull/3280 against 2.0.0.

The PR was closed without being applied, I don't know why but my guess is that either it's not considered a bug, my solution isn't good or the PR-message was too unclear or all of the above.

The reason I believe this is a bug is that Phalcon is unable to distinguish between a situation when a parameter is actually 0 and a situation when no parameter is given in the url. In my opinion these two situations are radically different and should be clearly distinguishable. Also as my examples below show, 0 and 0.0 are treated very differently which further indicates to me that this is a bug.

So Now I will try to state the issue more clearly and see if anybody can confirm if this is indeed a bug or the expected behavior.

The function IndexController::bugAction:

    class IndexController extends Controller
    {
        public function bugAction($param=null)
        {
            $matches = $this->router->getMatches();
            echo "<pre>matches:",print_r($matches,true),"</pre>";
            echo "<pre>param:",print_r($param,true),"</pre>";
        }
    }

An url in the browser that triggers the bug:

    https://mysite/index/bug/0

The result when bug is triggered:

    matches:Array
    (
        [0] => /index/bug/0
        [1] => bug
        [2] => /0
    )

    param:

An url in the browser that doesn not trigger the bug:

    https://mysite/index/bug/0.0

The result when bug is not triggered:

    matches:Array
    (
        [0] => /index/bug/0.0
        [1] => bug
        [2] => /0.0
    )

    param:0.0

EDIT:

It occurred to me that the routes probably are relevant so here they are:

$router->add(
    "(.*)",
    array(
        'namespace' => 'Myapp\Controllers',
        "controller" => "index",
        "action" => "index",
    )
);
// index with action, params
$router->add(
    "/index/:action/:params",
    array(
        "namespace" => 'Myapp\Controllers',
        "controller" => "index",
        "action" => 1,
        "params" => 2,
    )
);

// index with action
$router->add(
    "/index/:action",
    array(
        "namespace" => 'Myapp\Controllers',
        "controller" => "index",
        "action" => 1,
    )
);