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

$application->handle(); show a "Wrong number of parameters"

My php version is 7.3.3, phalcon 4.0.0-alpha.3

I start learning phalcon Basic Tutorial,

my document is localhost/phalcon/tutorial

$response = $application->handle(); //just here show a Exception: Wrong number of parameters

I tried https://forum.phalcon.io/discussion/19151/applicationhandle-triggers-a-wrong-number-of-parameters-error-af this method method1: $response = $application->handle(""); // this is working, but not going to each view phtml file

method2: $request = new Phalcon\Http\Request(); $response = $application->handle($request->getURI()); show Exception: PhalconController handler class cannot be loaded //my application directory is localhost/phalcon/tutorial

$application->handle() seems need a string parameter;

so how to solve it



8.4k

if you made the structure manually it could have something missing

to prevent these kind of problems i highly suggest you install phalcon dev-tools and use them to create your project

if you can paste the code at public/index.php

if you made the structure manually it could have something missing

to prevent these kind of problems i highly suggest you install phalcon dev-tools and use them to create your project

if you can paste the code at public/index.php

Even I git clone from github, this problem is same.

But the same code file in phalcon v3.4 works fine.



3.4k

It's a change from 3.x to 4.x - the line now needs to read:

$response = $application->handle($_SERVER['REQUEST_URI']);

there is a more framework pure version, but that's the one I've got and it's worked.

hth

edited May '19
try {
    $uri = explode('?', $di->get('request')->getURI());
    $response = $application->handle($uri[0] ?? '/');
    $response->send();
    // fastcgi_finish_request();
} catch (\Phalcon\Mvc\Dispatcher\Exception $e) {
    http_response_code(404);
}


51.3k

It would be nice to have invo app updated to take this into account.



10.1k

When the beta is out we will start working on upgrading the apps

Look through the line all whether the spaces and the sign are put correctly. It also matters when you're working on an app.

Also check about the semi-colums that you used. Sometime it's just the missing semi columns.

I saw even variations on cloud companies were theoritcally identical configuration Guide ought to doubtlessly have such overall performance distinction, due to the fact really not all servers are always using exactly same CPU.