Skip to content

Commit

Permalink
Fix PHP 8.3 Warning Passing null to parameter lines 163,167
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarvello committed May 17, 2024
1 parent 03f8d30 commit 0b52b27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions framework/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ private function parseUrlAndSetAttributes()
$this->currentSubSystem = "";

// Drop the last char from url string if it is equal to "/"
if (isset($this->urlToDispatch[strlen($this->urlToDispatch)]) && $this->urlToDispatch[strlen($this->urlToDispatch) - 1] == "/")
if (!empty($this->urlToDispatch) && isset($this->urlToDispatch[strlen($this->urlToDispatch)]) && $this->urlToDispatch[strlen($this->urlToDispatch) - 1] == "/")
$this->urlToDispatch = substr($this->urlToDispatch, 0, strlen($this->urlToDispatch) - 1);

// Generates an array from each sement of the url string delimited by a slash
$urlSegments = explode("/", $this->urlToDispatch);
// Generates an array from each segment of the url string delimited by a slash
$urlSegments = !empty($this->urlToDispatch) ? explode("/", $this->urlToDispatch) : "";

// First segment is the controller - store its name ad SEO name if controller is passed
if ($urlSegments[0] != "") {
if (!empty($urlSegments) && $urlSegments[0] != "") {
$this->controllerClass = "controllers\\" . $this->currentSubSystem . $this->underscoreToCamelCase($urlSegments[0], true);
$this->controllerSEOClassName = strtolower($urlSegments[0]);
} else {
Expand Down

0 comments on commit 0b52b27

Please sign in to comment.