Last modified: 2014-09-23 22:55:42 UTC
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!
Thanks for the bug report, Howard. Good catch. Have you been able to check whether this same problem happens in the most current version of MediaWiki (the code in git master)?
Hi, This was with version 1.21alpha (3cf0ce4) pulled from git in the last couple of days
Thanks for that update, Howard. CC'ing a couple people who could potentially fix.
I'm a bit puzzeled ... why shouldn't you put a semicolon at the end of the CREATE statement?
I think the rationale is that semicolon is only a separator of multiple SQL statements, not a mandatory syntax item.
If anybody wants to cook up a patch here, see https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/includes%2Fdb%2FDatabase.php#L3811 and https://www.mediawiki.org/wiki/Gerrit/Tutorial