Skip to content

Commit ae3a212

Browse files
committed
test
1 parent 59e37ab commit ae3a212

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

wp-includes/sqlite-ast/class-wp-pdo-mysql-on-sqlite.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5792,7 +5792,13 @@ function ( $column ) {
57925792
$this->quote_sqlite_identifier( $new_table_name ?? $table_name )
57935793
);
57945794
$create_table_query .= implode( ",\n", $rows );
5795-
$create_table_query .= "\n) STRICT";
5795+
$create_table_query .= "\n)";
5796+
5797+
$bypass_strict = defined( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS' ) && WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS;
5798+
if ( ! $bypass_strict ) {
5799+
$create_table_query .= ' STRICT';
5800+
}
5801+
57965802
return array_merge( array( $create_table_query ), $create_index_queries, $on_update_queries );
57975803
}
57985804

wp-includes/sqlite-ast/class-wp-sqlite-information-schema-builder.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,15 @@ public function temporary_table_exists( string $table_name ): bool {
392392
* database. Tables that are missing will be created.
393393
*/
394394
public function ensure_information_schema_tables(): void {
395+
$bypass_strict = defined( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS' ) && WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS;
395396
foreach ( self::INFORMATION_SCHEMA_TABLE_DEFINITIONS as $table_name => $table_body ) {
396397
$this->connection->query(
397398
sprintf(
398-
'CREATE TABLE IF NOT EXISTS %s%s (%s) STRICT',
399+
'CREATE TABLE IF NOT EXISTS %s%s (%s)%s',
399400
$this->table_prefix,
400401
$table_name,
401-
$table_body
402+
$table_body,
403+
$bypass_strict ? '' : ' STRICT'
402404
)
403405
);
404406
}
@@ -457,6 +459,7 @@ public function get_computed_information_schema_table_definition( string $table_
457459
* the SQLite database. Tables that are missing will be created.
458460
*/
459461
public function ensure_temporary_information_schema_tables(): void {
462+
$bypass_strict = defined( 'WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS' ) && WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS;
460463
foreach ( self::INFORMATION_SCHEMA_TABLE_DEFINITIONS as $table_name => $table_body ) {
461464
// Skip the "schemata" table; MySQL doesn't support temporary databases.
462465
if ( 'schemata' === $table_name ) {
@@ -465,10 +468,11 @@ public function ensure_temporary_information_schema_tables(): void {
465468

466469
$this->connection->query(
467470
sprintf(
468-
'CREATE TEMPORARY TABLE IF NOT EXISTS %s%s (%s) STRICT',
471+
'CREATE TEMPORARY TABLE IF NOT EXISTS %s%s (%s)%s',
469472
$this->temporary_table_prefix,
470473
$table_name,
471-
$table_body
474+
$table_body,
475+
$bypass_strict ? '' : ' STRICT'
472476
)
473477
);
474478
}

0 commit comments

Comments
 (0)