Open
Description
We noticed the following error:
Deprecated: addslashes(): Passing null to parameter #1 ($string) of type string is deprecated in sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php on line 107
sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php
Lines 95 to 108 in 037f6ef
I think that in certain cases null
is passed to the _real_escape
function.
In WordPress core they check on the type with is_scalar( $data )
:
/**
* Real escape using mysqli_real_escape_string().
*
* @since 2.8.0
*
* @see mysqli_real_escape_string()
*
* @param string $data String to escape.
* @return string Escaped string.
*/
public function _real_escape( $data ) {
if ( ! is_scalar( $data ) ) {
return '';
}
if ( $this->dbh ) {
$escaped = mysqli_real_escape_string( $this->dbh, $data );
} else {
$class = get_class( $this );
wp_load_translations_early();
/* translators: %s: Database access abstraction class, usually wpdb or a class extending wpdb. */
_doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' );
$escaped = addslashes( $data );
}
return $this->add_placeholder_escape( $escaped );
}
Maybe that should be added in this plugin too?
Metadata
Metadata
Assignees
Labels
No labels