Author: howardsmiller
Description:
To reproduce, follow the instructions in http://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates in order to create a new table. However, in the sql file do not put a semicolon on the end of the CREATE TABLE text.
Then run update.php and it will claim to have created the table but has not. Even with debugging turned up it doesn't complain.
Analysis:
The problem is in includes/db/Database.php function sourceStream(). This tries to recognise the end of a command either by feof becoming true or streamStatementEnd() finding the semicolon. However, an actual end of file will never end up in the block that executes $cmd, as an end-of-file will exit the while loop long before it gets to that if statement. Therefore, a missing semicolon causes the loop to drop through and return TRUE as if the file was empty.
The underlying issue is that the code to process $cmd should not be inside the loop. That's a bit weird!
Version: 1.21.x
Severity: major