$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



2.2k

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.1k

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


45.1k

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



7.7k

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

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

I think that you have to wait a bit and we will see an app. Nowadays there are a lot of different apps and they appear every day. Really an interesting subject of discussion. I think that the best profession in the nearest future is connected to coding and app development. But I suggest you think twice before you decide to start that career as it is not easy at all. Just read this article https://light-it.net/blog/detailed-overview-building-diabetes-management-app/ as an example of how much issues you can face when you will become any kind of software developer.