fix: DatabaseDumper dumpToFile() double-escapes newline after DROP TABLE #179
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
DatabaseDumper.php:329—fwrite($fp, 'DROP TABLE IF EXISTS \' . $abstractName . "\;\\n");The double-escaped backslash produces literal
\nin the SQL file instead of a newline. This concatenates the DROP TABLE statement with the CREATE TABLE statement, producing invalid SQL on import.The in-memory
dump()method doesn't have this issue — only the streamingdumpToFile()path (used by BackupEngine).Severity
Critical — corrupts every database backup created via the streaming path.
Location
source/packages/com_mokosuitebackup/src/Engine/DatabaseDumper.php:329Fix
Change
"\\;\n"to"`;\n"` (single-escaped newline).Branch created:
feature/179-fix-databasedumper-dumptofile-double-escConfirmed present in 02.56.05 — keep open.
DatabaseDumper.php:329writes'DROP TABLE IF EXISTS \' . $abstractName . "`;\n"— the\nin that double-quoted string emits a literal backslash+n, not a newline. Line 330 correctly uses"\n\n". Fix: change"`;\n"to"`;\n"`.