diff --git a/wp-includes/sqlite/class-wp-sqlite-token.php b/wp-includes/sqlite/class-wp-sqlite-token.php index 9976cf34..fbafd9e9 100644 --- a/wp-includes/sqlite/class-wp-sqlite-token.php +++ b/wp-includes/sqlite/class-wp-sqlite-token.php @@ -218,7 +218,7 @@ public function matches( $type = null, $flags = null, $values = null ) { return ( ( null === $type || $this->type === $type ) && ( null === $flags || ( $this->flags & $flags ) ) - && ( null === $values || in_array( strtoupper( $this->value ), $values, true ) ) + && ( null === $values || in_array( strtoupper( $this->value ?? '' ), $values, true ) ) ); } @@ -241,7 +241,7 @@ public function is_semantically_void() { private function extract() { switch ( $this->type ) { case self::TYPE_KEYWORD: - $this->keyword = strtoupper( $this->token ); + $this->keyword = strtoupper( $this->token ?? '' ); if ( ! ( $this->flags & self::FLAG_KEYWORD_RESERVED ) ) { /* * Unreserved keywords should stay the way they are @@ -256,7 +256,7 @@ private function extract() { return ' '; case self::TYPE_BOOL: - return strtoupper( $this->token ) === 'TRUE'; + return strtoupper( $this->token ?? '' ) === 'TRUE'; case self::TYPE_NUMBER: $ret = str_replace( '--', '', $this->token ); // e.g. ---42 === -42. diff --git a/wp-includes/sqlite/class-wp-sqlite-translator.php b/wp-includes/sqlite/class-wp-sqlite-translator.php index 284afe0e..d0bf0926 100644 --- a/wp-includes/sqlite/class-wp-sqlite-translator.php +++ b/wp-includes/sqlite/class-wp-sqlite-translator.php @@ -1550,7 +1550,7 @@ private function skip_index_hint() { array( 'JOIN', 'ORDER', 'GROUP' ) ) ) { $this->rewriter->skip(); // JOIN, ORDER, GROUP. - if ( 'BY' === strtoupper( $this->rewriter->peek()->value ) ) { + if ( 'BY' === strtoupper( $this->rewriter->peek()->value ?? '' ) ) { $this->rewriter->skip(); // BY. } } @@ -1572,7 +1572,7 @@ private function skip_index_hint() { */ private function execute_truncate() { $this->rewriter->skip(); // TRUNCATE. - if ( 'TABLE' === strtoupper( $this->rewriter->peek()->value ) ) { + if ( 'TABLE' === strtoupper( $this->rewriter->peek()->value ?? '' ) ) { $this->rewriter->skip(); // TABLE. } $this->rewriter->add( new WP_SQLite_Token( 'DELETE', WP_SQLite_Token::TYPE_KEYWORD ) ); @@ -2036,7 +2036,7 @@ private function skip_from_dual( $token ) { return false; } $from_table = $this->rewriter->peek_nth( 2 )->value; - if ( 'DUAL' !== strtoupper( $from_table ) ) { + if ( 'DUAL' !== strtoupper( $from_table ?? '' ) ) { return false; } @@ -2558,7 +2558,7 @@ private function capture_group_by( $token ) { return false; } $next = $this->rewriter->peek_nth( 2 )->value; - if ( 'BY' !== strtoupper( $next ) ) { + if ( 'BY' !== strtoupper( $next ?? '' ) ) { return false; } @@ -2909,8 +2909,8 @@ private function execute_alter() { new WP_SQLite_Token( $this->table_name, WP_SQLite_Token::TYPE_KEYWORD ), ) ); - $op_type = strtoupper( $this->rewriter->consume()->token ); - $op_subject = strtoupper( $this->rewriter->consume()->token ); + $op_type = strtoupper( $this->rewriter->consume()->token ?? '' ); + $op_subject = strtoupper( $this->rewriter->consume()->token ?? '' ); $mysql_index_type = $this->normalize_mysql_index_type( $op_subject ); $is_index_op = (bool) $mysql_index_type; @@ -3245,8 +3245,8 @@ private function execute_drop() { */ private function execute_show() { $this->rewriter->skip(); - $what1 = strtoupper( $this->rewriter->consume()->token ); - $what2 = strtoupper( $this->rewriter->consume()->token ); + $what1 = strtoupper( $this->rewriter->consume()->token ?? '' ); + $what2 = strtoupper( $this->rewriter->consume()->token ?? '' ); $what = $what1 . ' ' . $what2; switch ( $what ) { case 'CREATE PROCEDURE':