Set a default delimiter in Database::sourceStream
authoraddshore <addshorewiki@gmail.com>
Fri, 5 Jan 2018 15:37:30 +0000 (15:37 +0000)
committerAddshore <addshorewiki@gmail.com>
Fri, 5 Jan 2018 16:23:43 +0000 (16:23 +0000)
Discovered while debugging I7a4071072d802a82ecf7d16fbf8882ff8c79287f

DatabaseIntegration test alters the delimiter for the database instance
and it never gets set back.
Simply set the delimiter back to a default value at the start of
sourceSteam (for each new file pointer) which could have a new
delimiter.

Change-Id: Ib829b1c8d87271526fa6826910d40c304c778b32

includes/libs/rdbms/database/Database.php

index 15e02ad..30c9cdd 100644 (file)
@@ -3390,6 +3390,12 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                $fname = __METHOD__,
                callable $inputCallback = null
        ) {
+               $delimiterReset = new ScopedCallback(
+                       function ( $delimiter ) {
+                               $this->delimiter = $delimiter;
+                       },
+                       [ $this->delimiter ]
+               );
                $cmd = '';
 
                while ( !feof( $fp ) ) {
@@ -3435,6 +3441,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        }
                }
 
+               ScopedCallback::consume( $delimiterReset );
                return true;
        }