Unblock form handling: Check for 'Tags' index in $data from UI before trying to access it
authorAlex Monk <krenair@gmail.com>
Fri, 25 Mar 2016 04:05:39 +0000 (04:05 +0000)
committerAlex Monk <krenair@gmail.com>
Fri, 25 Mar 2016 17:27:56 +0000 (17:27 +0000)
Was showing this notice:
Undefined index: Tags in /path/to/mw/includes/specials/SpecialUnblock.php on line 241

The API sets this but the UI does not

Change-Id: Ibf31c2b9be4d4b621d1745fd87550a383c389f12

includes/specials/SpecialUnblock.php

index cc7a091..cff8bf4 100644 (file)
@@ -238,7 +238,9 @@ class SpecialUnblock extends SpecialPage {
                $logEntry->setTarget( $page );
                $logEntry->setComment( $data['Reason'] );
                $logEntry->setPerformer( $performer );
-               $logEntry->setTags( $data['Tags'] );
+               if ( isset( $data['Tags'] ) ) {
+                       $logEntry->setTags( $data['Tags'] );
+               }
                $logId = $logEntry->insert();
                $logEntry->publish( $logId );