escapeString() can get a null value.
This commit is contained in:
parent
ff2131f9e3
commit
09f47fc2d0
@ -46,7 +46,7 @@ abstract class DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ class MysqliDatabase extends DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
return mysqli_escape_string($this->db_conn, $string);
|
return mysqli_escape_string($this->db_conn, $string);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class PdoPostgresDatabase extends DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
return substr($this->db_conn->quote($string), 1, -1);
|
return substr($this->db_conn->quote($string), 1, -1);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class PdoSqliteDatabase extends DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
return substr($this->db_conn->quote($string), 1, -1);
|
return substr($this->db_conn->quote($string), 1, -1);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class PostgresDatabase extends DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
return pg_escape_string($string);
|
return pg_escape_string($string);
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ class SqlRelayDatabase extends DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
static $search = array("\x00", '%', "'", '\"');
|
static $search = array("\x00", '%', "'", '\"');
|
||||||
static $replace = array('%00', '%25', "''", '\\\"');
|
static $replace = array('%00', '%25', "''", '\\\"');
|
||||||
|
@ -60,7 +60,7 @@ class Sqlite3Database extends DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
static $search = array("\x00", '%', "'", '\"');
|
static $search = array("\x00", '%', "'", '\"');
|
||||||
static $replace = array('%00', '%25', "''", '\\\"');
|
static $replace = array('%00', '%25', "''", '\\\"');
|
||||||
|
@ -64,7 +64,7 @@ class SqliteDatabase extends DbAbstract
|
|||||||
/**
|
/**
|
||||||
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
* Returns an escaped string, so that it can be safely included in a SQL string encapsulated within quotes, without allowing SQL injection.
|
||||||
*/
|
*/
|
||||||
public function escapeString(string $string): string
|
public function escapeString($string): string
|
||||||
{
|
{
|
||||||
static $search = array("\x00", '%', "'", '\"');
|
static $search = array("\x00", '%', "'", '\"');
|
||||||
static $replace = array('%00', '%25', "''", '\\\"');
|
static $replace = array('%00', '%25', "''", '\\\"');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user