Chad has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/339488 )

Change subject: Protect against undefined owners
......................................................................

Protect against undefined owners

Owners might not be defined in the database if the election predates
the addition of the el_owner column. Avoid the non-existent property
warning in Store, and default to an empty string in Election when it's
not defined.

Change-Id: I8159edd7915ae68b42273c3516e37a475029ebd6
---
M includes/entities/Election.php
M includes/main/Store.php
2 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll 
refs/changes/88/339488/1

diff --git a/includes/entities/Election.php b/includes/entities/Election.php
index bde1b78..132f6ac 100644
--- a/includes/entities/Election.php
+++ b/includes/entities/Election.php
@@ -72,6 +72,7 @@
        public $questions, $auth, $ballot;
        public $id, $title, $ballotType, $tallyType, $primaryLang;
        public $startDate, $endDate, $authType;
+       public $owner = '';
 
        /**
         * Constructor.
@@ -91,7 +92,9 @@
                $this->startDate = $info['startDate'];
                $this->endDate = $info['endDate'];
                $this->authType = $info['auth'];
-               $this->owner = $info['owner'];
+               if ( isset( $info['owner'] ) ) {
+                       $this->owner = $info['owner'];
+               }
        }
 
        /**
diff --git a/includes/main/Store.php b/includes/main/Store.php
index fda55da..b0cb416 100644
--- a/includes/main/Store.php
+++ b/includes/main/Store.php
@@ -175,7 +175,7 @@
                foreach ( $map as $key => $field ) {
                        if ( $key == 'startDate' || $key == 'endDate' ) {
                                $info[$key] = wfTimestamp( TS_MW, $row->$field 
);
-                       } else {
+                       } elseif( isset( $row->$field ) ) {
                                $info[$key] = $row->$field;
                        }
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8159edd7915ae68b42273c3516e37a475029ebd6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Chad <ch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to