Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit ec80726

Browse files
committed
Fix binary type translation and BLOB column tests
1 parent a02ebba commit ec80726

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/WP_SQLite_Driver_Tests.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4622,9 +4622,9 @@ public function testNonStrictModeTypeCasting(): void {
46224622
$this->assertSame( '', $result[0]->col_text );
46234623
$this->assertSame( '0', $result[0]->col_bool );
46244624
$this->assertSame( '0', $result[0]->col_bit );
4625-
$this->assertSame( '0', $result[0]->col_binary ); // TODO: Should save ''.
4626-
$this->assertSame( '', $result[0]->col_varbinary );
4627-
$this->assertSame( '', $result[0]->col_blob );
4625+
$this->assertSame( PHP_VERSION_ID < 80100 ? null : '', $result[0]->col_binary );
4626+
$this->assertSame( PHP_VERSION_ID < 80100 ? null : '', $result[0]->col_varbinary );
4627+
$this->assertSame( PHP_VERSION_ID < 80100 ? null : '', $result[0]->col_blob );
46284628
$this->assertSame( '0000-00-00', $result[0]->col_date );
46294629
$this->assertSame( '00:00:00', $result[0]->col_time );
46304630
$this->assertSame( '0000-00-00 00:00:00', $result[0]->col_datetime );
@@ -4671,9 +4671,9 @@ public function testNonStrictModeTypeCasting(): void {
46714671
$this->assertSame( '', $result[0]->col_text );
46724672
$this->assertSame( '0', $result[0]->col_bool );
46734673
$this->assertSame( '0', $result[0]->col_bit );
4674-
$this->assertSame( '0', $result[0]->col_binary ); // TODO: Should save ''.
4675-
$this->assertSame( '', $result[0]->col_varbinary );
4676-
$this->assertSame( '', $result[0]->col_blob );
4674+
$this->assertSame( PHP_VERSION_ID < 80100 ? null : '', $result[0]->col_binary );
4675+
$this->assertSame( PHP_VERSION_ID < 80100 ? null : '', $result[0]->col_varbinary );
4676+
$this->assertSame( PHP_VERSION_ID < 80100 ? null : '', $result[0]->col_blob );
46774677
$this->assertSame( '0000-00-00', $result[0]->col_date );
46784678
$this->assertSame( '00:00:00', $result[0]->col_time );
46794679
$this->assertSame( '0000-00-00 00:00:00', $result[0]->col_datetime );

wp-includes/sqlite-ast/class-wp-sqlite-driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class WP_SQLite_Driver {
9494
WP_MySQL_Lexer::YEAR_SYMBOL => 'TEXT',
9595

9696
// Binary data types:
97-
WP_MySQL_Lexer::BINARY_SYMBOL => 'INTEGER',
97+
WP_MySQL_Lexer::BINARY_SYMBOL => 'BLOB',
9898
WP_MySQL_Lexer::VARBINARY_SYMBOL => 'BLOB',
9999
WP_MySQL_Lexer::TINYBLOB_SYMBOL => 'BLOB',
100100
WP_MySQL_Lexer::BLOB_SYMBOL => 'BLOB',
@@ -162,7 +162,7 @@ class WP_SQLite_Driver {
162162
'year' => 'TEXT',
163163

164164
// Binary data types:
165-
'binary' => 'INTEGER',
165+
'binary' => 'BLOB',
166166
'varbinary' => 'BLOB',
167167
'tinyblob' => 'BLOB',
168168
'blob' => 'BLOB',

0 commit comments

Comments
 (0)