summaryrefslogtreecommitdiff
path: root/ext/mysqli
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-09-18 15:25:35 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-09-18 15:25:35 +0200
commite6dc9abdb77aa72b9d1b8e2158ac6d8811b75e4b (patch)
tree931cbbb1bfaa6c6eeeb8fbc6e5db95825ee7be98 /ext/mysqli
parentd87c393a18aaeed0019ab64880031d9fb4ab414f (diff)
parent70cba36fc92c1e75c5b0f9ebd1f97a68c26c170a (diff)
downloadphp-git-e6dc9abdb77aa72b9d1b8e2158ac6d8811b75e4b.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Support NO_BACKSLASH_ESCAPES with newer libmysqlclient
Diffstat (limited to 'ext/mysqli')
-rw-r--r--ext/mysqli/mysqli_api.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 06eb3c3d32..604c83884e 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1941,6 +1941,11 @@ PHP_FUNCTION(mysqli_real_query)
}
/* }}} */
+#if defined(PDO_USE_MYSQLND) || MYSQL_VERSION_ID < 50707 || defined(MARIADB_BASE_VERSION)
+# define mysql_real_escape_string_quote(mysql, to, from, length, quote) \
+ mysql_real_escape_string(mysql, to, from, length)
+#endif
+
/* {{{ proto string mysqli_real_escape_string(object link, string escapestr)
Escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection */
PHP_FUNCTION(mysqli_real_escape_string) {
@@ -1956,7 +1961,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
newstr = zend_string_alloc(2 * escapestr_len, 0);
- ZSTR_LEN(newstr) = mysql_real_escape_string(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len);
+ ZSTR_LEN(newstr) = mysql_real_escape_string_quote(mysql->mysql, ZSTR_VAL(newstr), escapestr, escapestr_len, '\'');
newstr = zend_string_truncate(newstr, ZSTR_LEN(newstr), 0);
RETURN_NEW_STR(newstr);