Skip to content

Commit

Permalink
Fixed issue #05732: Warning: htmlspecialchars() expects at most 3 par…
Browse files Browse the repository at this point in the history
…ameters

Dev 4th parameter only supported in php versions starting with 5.2.3

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@12266 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
tmswhite committed Jan 31, 2012
1 parent 4c4d225 commit a7f7761
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions classes/eval/ExpressionManager.php
Expand Up @@ -1468,19 +1468,41 @@ public function GetPrettyPrintString()
$descriptor .= ': ';
}

$messages[] = $descriptor . htmlspecialchars($question,ENT_QUOTES,'UTF-8',false);
if ($ansList != '')
if (strnatcmp(phpversion(), "5.2.3")>=0)
{
$messages[] = htmlspecialchars($ansList,ENT_QUOTES,'UTF-8',false);
// 4th parameter to htmlspecialchars only became available in PHP version 5.2.3
$messages[] = $descriptor . htmlspecialchars($question,ENT_QUOTES,'UTF-8',false);
if ($ansList != '')
{
$messages[] = htmlspecialchars($ansList,ENT_QUOTES,'UTF-8',false);
}
if ($code != '') {
if ($token[2] == 'SGQA' && preg_match('/^INSERTANS:/',$token[0])) {
$shown = $this->GetVarAttribute($token[0], 'shown', '');
$messages[] = 'value=[' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false) . '] '
. htmlspecialchars($shown,ENT_QUOTES,'UTF-8',false);
}
else {
$messages[] = 'value=' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false);
}
}
}
if ($code != '') {
if ($token[2] == 'SGQA' && preg_match('/^INSERTANS:/',$token[0])) {
$shown = $this->GetVarAttribute($token[0], 'shown', '');
$messages[] = 'value=[' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false) . '] '
. htmlspecialchars($shown,ENT_QUOTES,'UTF-8',false);
else
{
$messages[] = $descriptor . htmlspecialchars($question,ENT_QUOTES,'UTF-8');
if ($ansList != '')
{
$messages[] = htmlspecialchars($ansList,ENT_QUOTES,'UTF-8');
}
else {
$messages[] = 'value=' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false);
if ($code != '') {
if ($token[2] == 'SGQA' && preg_match('/^INSERTANS:/',$token[0])) {
$shown = $this->GetVarAttribute($token[0], 'shown', '');
$messages[] = 'value=[' . htmlspecialchars($code,ENT_QUOTES,'UTF-8') . '] '
. htmlspecialchars($shown,ENT_QUOTES,'UTF-8');
}
else {
$messages[] = 'value=' . htmlspecialchars($code,ENT_QUOTES,'UTF-8');
}
}
}
if ($this->groupSeq == -1 || $groupSeq == -1 || $questionSeq == -1 || $this->questionSeq == -1) {
Expand Down

0 comments on commit a7f7761

Please sign in to comment.