Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions wp-includes/sqlite/class-wp-sqlite-token.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
);
}

Expand All @@ -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
Expand All @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions wp-includes/sqlite/class-wp-sqlite-translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}
Expand All @@ -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 ) );
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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':
Expand Down