Skip to content

Commit

Permalink
Dev: giving up about isset vs !empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Jun 17, 2017
1 parent 7269bc7 commit 598b216
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions application/core/Survey_Common_Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function _addPseudoParams($params)
/* Control sid,gid and qid params validity see #12434 */
// Fill param with according existing param, replace existing parameters.
// iGroupId/gid can be found with qid/iQuestionId
if(isset($params['iQuestionId']) && $params['iQuestionId']!=='') {
if(!empty($params['iQuestionId'])) {
if((string)(int)$params['iQuestionId']!==(string)$params['iQuestionId']) { // pgsql need filtering before find
throw new CHttpException(403,gT("Invalid question id"));
}
Expand All @@ -163,7 +163,7 @@ private function _addPseudoParams($params)
}
}
// iSurveyId/iSurveyID/sid can be found with gid/iGroupId
if(isset($params['iGroupId']) && $params['iGroupId']!=='') {
if(!empty($params['iGroupId'])) {
if((string)(int)$params['iGroupId']!==(string)$params['iGroupId']) { // pgsql need filtering before find
throw new CHttpException(403,gT("Invalid group id"));
}
Expand All @@ -176,7 +176,7 @@ private function _addPseudoParams($params)
}
}
// Finally control validity of sid
if(isset($params['iSurveyId']) && $params['iSurveyId']!=='') {
if(!empty($params['iSurveyId'])) {
if((string)(int)$params['iSurveyId']!==(string)$params['iSurveyId']) { // pgsql need filtering before find
// 403 mean The request was valid, but the server is refusing action.
throw new CHttpException(403,gT("Invalid survey id"));
Expand Down

0 comments on commit 598b216

Please sign in to comment.