phpMv / ubiquity

Ubiquity framework
https://ubiquity.kobject.net
Apache License 2.0
691 stars 60 forks source link

Add Route status in getRoute method #314

Closed andrejro2 closed 8 months ago

andrejro2 commented 1 year ago

Description

I faced the issue in my custom onError function.

"onError" => function ($code, $message, $controllerInstance) {
    $statusCode = Router::getStatusCode();
    if ($statusCode !== $code) {
      $code = $statusCode;
      $message = null;
    }
    switch ($code) {
//Switch code.
    }
  }

I check the Router status with Router::getStatusCode(). In the case of 404 status, it generates an exception because getStatusCode() returns null (should return an int). That is because StatusCode wasn't set.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

jcheron commented 8 months ago

Closed due to lack of response