Skip to content

Commit

Permalink
Fixed issue #9025: Error showing pie chart in statistics when using M…
Browse files Browse the repository at this point in the history
…S SQL server
  • Loading branch information
c-schmitz committed Jun 18, 2014
1 parent b450e53 commit 58c9dab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/controllers/admin/statistics.php
Expand Up @@ -532,8 +532,9 @@ function graph()
// Strip first char when not numeric (probably T or D)
$qsid=substr($qsid,1);
}
$oQuestion=Question::model()->findByAttributes(array('qid'=>$qqid,'language'=>$sStatisticsLanguage));
$qtype = $oQuestion->type;
$aFieldmap=createFieldMap($qsid,'full',false,false,$sStatisticsLanguage);
$qtype=$aFieldmap[$_POST['id']]['type'];
$qqid=$aFieldmap[$_POST['id']]['qid'];
$aattr = getQuestionAttributeValues($qqid);
$field = substr($_POST['id'], 1);

Expand Down

6 comments on commit 58c9dab

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The findByAttributes is broken on MSSQL ?

@c-schmitz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, mysql is just more lenient if you feed crap to it ;).

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, then MSSQL help to find bug ;)

@SamMousa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to at least escape the variables if you move away from ActiveRecord?

@c-schmitz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where?

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$_POST['id']]['type'] and $_POST['id']]['qid'] i think (and sanitize)

But i prefer to find a way to search type from qid. And do it from Yii model (no need to sanitize)

Please sign in to comment.