Skip to content

Commit

Permalink
[3.10] [PHP 8.1] Mysqli database driver escapt function fix
Browse files Browse the repository at this point in the history
Fixes `Deprecated: mysqli_real_escape_string(): Passing null to parameter #2 ($string) of type string is deprecated in libraries/joomla/database/driver/mysqli.php on line 254`
  • Loading branch information
beat committed Jan 22, 2022
1 parent b2206b0 commit a807845
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/joomla/database/driver/mysqli.php
Expand Up @@ -246,12 +246,12 @@ public function escape($text, $extra = false)
if (is_float($text))
{
// Force the dot as a decimal point.
return str_replace(',', '.', $text);
return str_replace(',', '.', (string) $text);
}

$this->connect();

$result = mysqli_real_escape_string($this->getConnection(), $text);
$result = mysqli_real_escape_string($this->getConnection(), (string) $text);

if ($extra)
{
Expand Down

0 comments on commit a807845

Please sign in to comment.