-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunctions.php
31 lines (29 loc) · 837 Bytes
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php declare(strict_types=1);
if (!function_exists('mysql_escape_string')) {
/**
* mysql_escape_string — Escapes a string for use in a mysql_query
*
* @link https://dev.mysql.com/doc/refman/8.0/en/string-literals.html#character-escape-sequences
*
* @param string $unescaped_string
* @return string
* @deprecated
*/
function mysql_escape_string(string $unescaped_string): string
{
$replacementMap = [
"\0" => "\\0",
"\n" => "\\n",
"\r" => "\\r",
"\t" => "\\t",
chr(26) => "\\Z",
chr(8) => "\\b",
'"' => '\"',
"'" => "\'",
'_' => "\_",
"%" => "\%",
'\\' => '\\\\'
];
return \strtr($unescaped_string, $replacementMap);
}
}