diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-18 15:25:35 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-18 15:25:35 +0200 |
commit | e6dc9abdb77aa72b9d1b8e2158ac6d8811b75e4b (patch) | |
tree | 931cbbb1bfaa6c6eeeb8fbc6e5db95825ee7be98 /ext/mysqli | |
parent | d87c393a18aaeed0019ab64880031d9fb4ab414f (diff) | |
parent | 70cba36fc92c1e75c5b0f9ebd1f97a68c26c170a (diff) | |
download | php-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.c | 7 |
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); |