@@ -428,48 +428,31 @@ jobs:
428428 working-directory : packages/mysql-on-sqlite
429429 run : |
430430 python3 - <<'PY'
431- import re
432-
433- # 1. Turso doesn't expose `sqlite_temp_master`. The driver queries it
434- # to decide whether to use temp-schema tables, but Turso doesn't
435- # support TEMP tables at all, so the predicate is always false.
436- path = 'src/sqlite/class-wp-sqlite-information-schema-builder.php'
431+ # Bisect result: temporary_table_exists → false changes test flow in a
432+ # way that trips a Turso sqlite3_finalize deadlock during PHP GC,
433+ # hanging the suite at test 504/667. Keep only the wp_die polyfill,
434+ # which doesn't change driver/query behaviour.
435+ #
436+ # The sync_column_key_info row-value UPDATE rewrite ran into a
437+ # separate Turso pathological case; also left alone.
438+
439+ # wp_die polyfill: 21 tests hit an error path in the driver that
440+ # calls wp_die(). Real WordPress provides it; the unit-test bootstrap
441+ # does not. Add a minimal polyfill.
442+ path = 'tests/bootstrap.php'
437443 src = open(path).read()
438- old = (
439- "\tpublic function temporary_table_exists( string $table_name ): bool {\n"
440- "\t\t/*\n"
441- "\t\t * We could search in the \"{$this->temporary_table_prefix}tables\" table,\n"
442- "\t\t * but it may not exist yet, so using \"sqlite_temp_master\" is simpler.\n"
443- "\t\t */\n"
444- "\t\t$stmt = $this->connection->query(\n"
445- "\t\t\t\"SELECT 1 FROM sqlite_temp_master WHERE type = 'table' AND name = ?\",\n"
446- "\t\t\tarray( $table_name )\n"
447- "\t\t);\n"
448- "\t\treturn $stmt->fetchColumn() === '1';\n"
449- "\t}"
444+ marker = "if ( ! function_exists( 'do_action' ) ) {"
445+ inject = (
446+ "if ( ! function_exists( 'wp_die' ) ) {\n"
447+ "\tfunction wp_die( $message = '', $title = '', $args = array() ) {\n"
448+ "\t\tthrow new \\RuntimeException( is_string( $message ) ? $message : 'wp_die' );\n"
449+ "\t}\n"
450+ "}\n\n"
450451 )
451- new = (
452- "\tpublic function temporary_table_exists( string $table_name ): bool {\n"
453- "\t\t// Turso compatibility: it does not support TEMP tables or\n"
454- "\t\t// expose sqlite_temp_master, so this is always false.\n"
455- "\t\treturn false;\n"
456- "\t}"
457- )
458- assert old in src, 'temporary_table_exists body not found'
459- src = src.replace(old, new, 1)
460-
461- # (Earlier attempt also rewrote sync_column_key_info's UPDATE to
462- # work around Turso's lack of row-value assignment from a subquery,
463- # but the rewrite caused PHPUnit to hang indefinitely on a specific
464- # test around position 504/667 — likely a pathological case in
465- # Turso's query planner. Dropped for now; the 40 affected tests
466- # remain errors.)
452+ assert marker in src
453+ src = src.replace(marker, inject + marker, 1)
467454 open(path, 'w').write(src)
468- print('patched information-schema-builder.php (temporary_table_exists only)')
469-
470- # (wp_die polyfill disabled while bisecting which patch causes the
471- # hang at test 504/667. Without any driver patch the suite runs to
472- # completion; WITH temporary_table_exists + wp_die it hangs.)
455+ print('added wp_die polyfill to bootstrap.php')
473456 PY
474457
475458 - name : Capture failing SQL from the first failing driver test
0 commit comments