Skip to content

Commit

Permalink
PHP 8.1: Fix addslashes(): Passing null to parameter #1 () of type st…
Browse files Browse the repository at this point in the history
…ring is deprecated (#140)

* PHP 8.1: Fix addslashes(): Passing null to parameter #1 () of type string is deprecated

* Fix linting since it complains about the null coalescing

* PHP 8.1: Fix addslashes(): Passing null to parameter #1 () of type string is deprecated
  • Loading branch information
rebeccahum authored Oct 16, 2023
1 parent 09c9624 commit d8f68ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion db.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ public function set_charset( $dbh, $charset = null, $collate = null ) {
* This is also the reason why we don't allow certain charsets. See set_charset().
*/
public function _real_escape( $string ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
$escaped = addslashes( $string );
$escaped = addslashes( (string) $string );
if ( method_exists( get_parent_class( $this ), 'add_placeholder_escape' ) ) {
$escaped = $this->add_placeholder_escape( $escaped );
}
Expand Down

0 comments on commit d8f68ef

Please sign in to comment.