mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00: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. git-svn-id: https://develop.svn.wordpress.org/trunk@48980 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
aadc1d70f2
commit
35ceac68f4
@ -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