Last modified: 2014-09-23 22:55:42 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T42979, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40979 - When creating a table via 'LoadExtensionSchemaUpdates' a missing semicolon in the sql file silently fails
When creating a table via 'LoadExtensionSchemaUpdates' a missing semicolon in...
Status: UNCONFIRMED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.21.x
All All
: High major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-12 14:06 UTC by Howard Miller
Modified: 2014-09-23 22:55 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Howard Miller 2012-10-12 14:06:59 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!
Comment 1 Sumana Harihareswara 2012-10-12 19:11:52 UTC
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)?
Comment 2 Howard Miller 2012-10-13 12:49:01 UTC
Hi,

This was with version 1.21alpha (3cf0ce4) pulled from git in the last couple of days
Comment 3 Sumana Harihareswara 2012-10-13 12:51:14 UTC
Thanks for that update, Howard. CC'ing a couple people who could potentially fix.
Comment 4 Jure Kajzer 2012-12-31 14:51:35 UTC
I'm a bit puzzeled ... why shouldn't you put a semicolon at the end of the CREATE statement?
Comment 5 Marcin Cieślak 2012-12-31 21:52:51 UTC
I think the rationale is that semicolon is only a separator of multiple SQL statements, not a mandatory syntax item.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links