Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

$application->handle(); triggers a "Wrong number of parameters" error after last upgrade

After the last upgrade to 4.0.0-alpha1 (Version 0.11.8-4495e75), my main application does not work anymore and returns a "Wrong number of parameters" error message.

It worked before the upgrade. I start my application just like in the Basic Tutorial:

//Create the main application 
$application = new \Phalcon\Mvc\Application($di);

try {
    // Handle the request

    $response = $application->handle(); //This guy stopped working
    $response->send();

} catch (\Exception $e) {
    echo $e->getMessage();
}

It looks like handle() now wants a parameter (the uri?) If I set one, it seems to work but then my website would only display a single url (the baseUri) regardless of which parameter I set in the handle() function.

Any idea ?



6.1k
Accepted
answer
edited Jan '19

You need to pass in the URI. For example you could use $_SERVER['REQUEST_URI'] or use the Phalcon request class

$request = new Phalcon\Http\Request();
$application->handle($request->getURI())

Probally you can get the Request from the DI



676

Just tried with a new Request and it worked !

// Handle the request
$request = new Phalcon\Http\Request();
$response = $application->handle($request->getURI());
#$response = $application->handle(""); //This guy stopped working
$response->send();

Is the documentation going to be updated ?

You need to pass in the URI. For example you could use $_SERVER['REQUEST_URI'] or use the Phalcon request class

$request = new Phalcon\Http\Request();
$application->handle($request->getURI())

Probally you can get the Request from the DI



6.1k

Is the documentation going to be updated ?

Will be part of the final release for sure. Some info can already be found on the blog and you can track the status of the issues here