mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Code Modernization: Return an empty string from wpdb::_real_escape()
if a non-scalar value is passed.
This avoids a fatal error on PHP 8 caused by passing a non-string value to ` mysqli_real_escape_string()`, and maintains the current behaviour. See #50913, #50639. Built from https://develop.svn.wordpress.org/trunk@48980 git-svn-id: http://core.svn.wordpress.org/trunk@48742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b37e0cec1b
commit
9734ed5673
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-alpha-48979';
|
||||
$wp_version = '5.6-alpha-48980';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
@ -1159,6 +1159,10 @@ class wpdb {
|
||||
* @return string Escaped string.
|
||||
*/
|
||||
function _real_escape( $string ) {
|
||||
if ( ! is_scalar( $string ) && ! is_null( $string ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( $this->dbh ) {
|
||||
if ( $this->use_mysqli ) {
|
||||
$escaped = mysqli_real_escape_string( $this->dbh, $string );
|
||||
|
Loading…
Reference in New Issue
Block a user