https://bugzilla.wikimedia.org/show_bug.cgi?id=40979

       Web browser: ---
             Bug #: 40979
           Summary: When creating a table via 'LoadExtensionSchemaUpdates'
                    a missing semicolon in the sql file silently fails
           Product: MediaWiki
           Version: 1.20
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: Database
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: howardsmil...@gmail.com
    Classification: Unclassified
   Mobile Platform: ---


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!

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to