Fix regular expression
authorJakub Vrana <jakub@vrana.cz>
Sat, 1 Dec 2018 08:55:29 +0000 (09:55 +0100)
committerThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Mon, 3 Dec 2018 17:49:23 +0000 (18:49 +0100)
Found by PHPStan.

Change-Id: I95813b0db9a3d6ca8c3894e5ccba00a9dc84b336

includes/libs/rdbms/field/SQLiteField.php

index 39f8f01..fdf96fe 100644 (file)
@@ -21,8 +21,8 @@ class SQLiteField implements Field {
        function defaultValue() {
                if ( is_string( $this->info->dflt_value ) ) {
                        // Typically quoted
-                       if ( preg_match( '/^\'(.*)\'$', $this->info->dflt_value ) ) {
-                               return str_replace( "''", "'", $this->info->dflt_value );
+                       if ( preg_match( '/^\'(.*)\'$/', $this->info->dflt_value, $matches ) ) {
+                               return str_replace( "''", "'", $matches[1] );
                        }
                }