Skip to content

Commit

Permalink
PHP 8.0: @ Error Suppression operator does not silent fatal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Oct 2, 2023
1 parent c52381b commit d2a1c12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/FilterInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ public function cleanVar($source, $type = 'string')
case 'INTEGER':
// Only use the first integer value
preg_match('/-?\d+/', (string) $source, $matches);
$result = @ (int) $matches[0];
$result = isset($matches[0]) ? (int) $matches[0] : 0;
break;

case 'FLOAT':
case 'DOUBLE':
// Only use the first floating point value
preg_match('/-?\d+(\.\d+)?/', (string) $source, $matches);
$result = @ (float) $matches[0];
$result = isset($matches[0]) ? (float) $matches[0] : 0;
break;

case 'BOOL':
Expand Down Expand Up @@ -259,7 +259,7 @@ public function cleanVar($source, $type = 'string')
$source = trim((string) $source);
$pattern = '/^([-_\.\/A-Z0-9=&%?~]+)(.*)$/i';
preg_match($pattern, $source, $matches);
$result = @ (string) $matches[1];
$result = isset($matches[1]) ? (string) $matches[1] : '';
break;

case 'USERNAME':
Expand Down

0 comments on commit d2a1c12

Please sign in to comment.