Skip to content

Commit

Permalink
Fixed issue: Files cannot be downloaded if magic_quotes is activated …
Browse files Browse the repository at this point in the history
…on the server
  • Loading branch information
c-schmitz committed Nov 7, 2014
1 parent fbf3466 commit 0a0633a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7269,7 +7269,11 @@ function fixSubquestions()
*/
function ls_json_encode($content)
{
$ans = json_encode(stripslashes($content));
if (is_string($content))
{
$content=stripslashes($content);
}
$ans = json_encode($content);
$ans = str_replace(array('{','}'),array('{ ',' }'), $ans);
return $ans;
}
Expand Down

2 comments on commit 0a0633a

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have to test if magic_quote is active ?

if (is_string($content) && get_magic_quotes_gpc ())
{
    $content=stripslashes($content);
}

ans same on decode ? json_encode add slash.

@SamMousa
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should assume it's off. If not we should instead just warn the user during installation:
http://php.net/manual/en/security.magicquotes.php

Since we require php 5.3 where it is deprecated it makes no sense to add code to support this.

Please sign in to comment.