Skip to content

Commit

Permalink
updated php version and a fix
Browse files Browse the repository at this point in the history
- Supported PHP version is changed to PHP 8.1 and above.
- Removed Filter check for URIPATH in match_route method as FILTER_SANITIZE_STRING is deprecated in PHP 8.1
  • Loading branch information
raghuveer committed Sep 6, 2023
1 parent 8c6d0ef commit 760e834
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
With Composer, run

```sh
composer require easeappphp/ea-router:^1.0.7
composer require easeappphp/ea-router:^1.0.8
```

# Sample Routes
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"homepage": "https://www.easeapp.org/",
"type": "library",
"require": {
"php": ">=7.3"
"php": ">=8.1"
},
"require-dev": {
"php": ">=7.3"
"php": ">=8.1"
},
"license": "MIT",
"authors": [
Expand Down
5 changes: 3 additions & 2 deletions src/EARouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use function mb_strlen;
use function filter_var;
use function implode;
use const FILTER_SANITIZE_STRING;
//use const FILTER_SANITIZE_STRING;

/**
* EARouter Class
Expand Down Expand Up @@ -149,7 +149,8 @@ public function getFromFilepathsArray($filepathsArray)
*/
public function matchRoute($routesArray, $uriPath, $queryStringArray, $receivedRequestMethod, $configuredMaxRouteLength)
{
if (mb_strlen(filter_var($uriPath, FILTER_SANITIZE_STRING))<$configuredMaxRouteLength) {
//if (mb_strlen(filter_var($uriPath, FILTER_SANITIZE_STRING))<$configuredMaxRouteLength) {
if (mb_strlen($uriPath)<$configuredMaxRouteLength) {

$this->uriPathParams = $this->getUriPathParams($uriPath);

Expand Down
10 changes: 10 additions & 0 deletions tests/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php'; // Autoload files using Composer autoload

use EARouter\EARouter;

//$eaRouter = new EARouter(RouterInterface $routerInterface);
$eaRouter = new EARouter();
$eaRouterUriPathParams = $eaRouter->getUriPathParams($_SERVER['REQUEST_URI']);

print_r($eaRouterUriPathParams);

0 comments on commit 760e834

Please sign in to comment.