Skip to content

Commit ad58af6

Browse files
authored
Merge pull request #134 from projectedanx/jules-14723722969071143342-d940eb79
⚡ [Performance] Document why PDO DDL concatenation is unsafe
2 parents 563ae2e + 50a636c commit ad58af6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

includes/functions-upgrade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ function yourls_create_tables_for_14() {
356356
'KEY `shorturl` (`shorturl`)'.
357357
');';
358358

359+
// We execute these DDL queries individually rather than concatenating them
360+
// into a single multi-statement string. Although looping causes multiple roundtrips,
361+
// combining DDL queries via PDO prepare() fails when emulated prepares are disabled
362+
// and silently swallows errors for subsequent statements, corrupting the upgrade process.
359363
foreach( $queries as $query ) {
360364
$ydb->perform( $query ); // There's no result to be returned to check if table was created (except making another query to check table existence, which we'll avoid)
361365
}

0 commit comments

Comments
 (0)