jenkins-bot has submitted this change and it was merged.

Change subject: Fix deepest common root when first path is longer and later is 
a prefix
......................................................................


Fix deepest common root when first path is longer and later is a prefix

Bug: T133731
Change-Id: I08baf5c94f26a50b4f17e2ccc0eab89053742817
---
M includes/Notifications/Controller.php
M tests/phpunit/Notifications/NotificationControllerTest.php
2 files changed, 23 insertions(+), 2 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Notifications/Controller.php 
b/includes/Notifications/Controller.php
index 25fc921..6eb166a 100644
--- a/includes/Notifications/Controller.php
+++ b/includes/Notifications/Controller.php
@@ -750,7 +750,7 @@
                        $possibleDeepestRoot = $firstPath[$i];
 
                        foreach ( $rootPaths as $path ) {
-                               if ( !$path[$i]->equals( $possibleDeepestRoot ) 
) {
+                               if ( !isset( $path[$i] ) || !$path[$i]->equals( 
$possibleDeepestRoot ) ) {
                                        // Mismatch.  Return the last match we 
found
                                        return $deepestRoot;
                                }
diff --git a/tests/phpunit/Notifications/NotificationControllerTest.php 
b/tests/phpunit/Notifications/NotificationControllerTest.php
index 410ccea..a15a976 100644
--- a/tests/phpunit/Notifications/NotificationControllerTest.php
+++ b/tests/phpunit/Notifications/NotificationControllerTest.php
@@ -44,7 +44,7 @@
                        ),
                        array(
                                UUID::create( 't2et6t35psmz1ac2' ),
-                               'Not same length',
+                               'First shorter',
                                array(
                                        't2f2mdjbw1dcfkia' => array(
                                                UUID::create( 
't2et4aiiijstihea' ),
@@ -61,6 +61,27 @@
                                        ),
                                ),
                        ),
+                       array(
+                               UUID::create( 't2f2re4e901we1zm' ),
+                               'First longer, second truncated version of 
first',
+                               array(
+                                       't2feoifdgpa2rt02' => array(
+                                               UUID::create( 
't2et4aiiijstihea' ),
+                                               UUID::create( 
't2et4aiwjnpnk5ua' ),
+                                               UUID::create( 
't2et6t35psmz1ac2' ),
+                                               UUID::create( 
't2f2mdjbw1dcfkia' ),
+                                               UUID::create( 
't2f2re4e901we1zm' ),
+                                               UUID::create( 
't2feoifdgpa2rt02' ),
+                                       ),
+                                       't2f2re4e901we1zm' => array(
+                                               UUID::create( 
't2et4aiiijstihea' ),
+                                               UUID::create( 
't2et4aiwjnpnk5ua' ),
+                                               UUID::create( 
't2et6t35psmz1ac2' ),
+                                               UUID::create( 
't2f2mdjbw1dcfkia' ),
+                                               UUID::create( 
't2f2re4e901we1zm' ),
+                                       ),
+                               ),
+                       ),
                );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/285448
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I08baf5c94f26a50b4f17e2ccc0eab89053742817
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to