Skip to content

Commit 70fc689

Browse files
committed
Fix: Final refinement of plugin compatibility regexes for multi-line and trailing LIMIT
1 parent 34646a5 commit 70fc689

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • integrations/plugin-compatibility

integrations/plugin-compatibility/boot.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ function wp_sqlite_integration_plugin_compat( $query ) {
2828
return 'SELECT 1 WHERE 1=0';
2929
}
3030

31-
// 2. Global fallback for FOR UPDATE / SKIP LOCKED.
31+
// 2. Global fallback for FOR UPDATE / SKIP LOCKED / NOWAIT.
3232
// This ensures the legacy driver natively ignores these locking constraints where SQLite faults.
33-
// We use a non-destructive lookahead for whitespace, semicolon, or comments to avoid destroying strings.
33+
// We use a non-destructive lookahead for whitespace, semicolon, comments, or LIMIT.
3434
if ( stripos( $query, 'FOR UPDATE' ) !== false ) {
35-
$query = preg_replace( '/\s+FOR\s+UPDATE(?:\s+(?:SKIP\s+LOCKED|NOWAIT))?(?=\s*(?:;|\/\*|$))/i', '', $query );
35+
$query = preg_replace( '/\s+FOR\s+UPDATE(?:\s+(?:SKIP\s+LOCKED|NOWAIT))?(?=\s*(?:;|\/\*|$|\s+LIMIT))/is', '', $query );
3636
}
3737

3838
// 3. Action Scheduler specific compatibility fixes.

0 commit comments

Comments
 (0)