$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



5.6k

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.



2.9k

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);
}


48.2k

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



9.7k

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.