BryanDavis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/100746


Change subject: Validate application id
......................................................................

Validate application id

Use Form class to validate that id is a non-negative integer if provided
in the query string.

Bug: 58306
Change-Id: I38224f124d45a82a18c2fb99b37db48126c027d2
---
M src/Wikimania/Scholarship/Controllers/Review/Application.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/wikimania-scholarships 
refs/changes/46/100746/1

diff --git a/src/Wikimania/Scholarship/Controllers/Review/Application.php 
b/src/Wikimania/Scholarship/Controllers/Review/Application.php
index 7d9b300..2fda81d 100644
--- a/src/Wikimania/Scholarship/Controllers/Review/Application.php
+++ b/src/Wikimania/Scholarship/Controllers/Review/Application.php
@@ -33,16 +33,16 @@
 class Application extends Controller {
 
        protected function handleGet() {
+               $this->form->expectInt( 'id', array( 'min_range' => 0 ) );
                $this->form->expectInt( 'phase',
                        array( 'min_range' => 0, 'max_range' => 2, 'default' => 
2 )
                );
                $this->form->validate( $_GET );
+               $id = $this->form->get( 'id' );
                $phase = $this->form->get( 'phase' );
                $userId = $this->authManager->getuserId();
 
-               $id = $this->request->get( 'id' );
-
-               if ( $id === null || $id < 0 ) {
+               if ( $id === null ) {
                        // Attempt to find first unreviewed application for the 
current user
                        $unreviewed = $this->dao->myUnreviewed( $phase );
                        if ( $unreviewed ) {
@@ -54,7 +54,7 @@
                $this->view->set( 'id', $id );
 
                $schol = false;
-               if ( $id !== '' && $id >= 0 ) {
+               if ( $id !== null && $id >= 0 ) {
                        $schol = $this->dao->getScholarship( $id );
                }
                $this->view->set( 'schol', $schol );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38224f124d45a82a18c2fb99b37db48126c027d2
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/wikimania-scholarships
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>

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

Reply via email to