Skip to content

Commit

Permalink
Now both p() and s() respect html entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Sep 10, 2005
1 parent 1ba6745 commit 43ea696
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/weblib.php
Expand Up @@ -101,7 +101,7 @@ function s($var) {
if ($var == '0') { // for integer 0, boolean false, string '0'
return '0';
}
return htmlSpecialChars(stripslashes_safe($var));
return preg_replace("/&(\w+|#\d+);/i", "&$1;", htmlspecialchars(stripslashes_safe($var)));
}

/**
Expand All @@ -114,11 +114,7 @@ function s($var) {
* @return string
*/
function p($var) {
if ($var == '0') { // for integer 0, boolean false, string '0'
echo '0';
} else {
echo htmlSpecialChars(stripslashes_safe($var));
}
echo s($var);
}


Expand Down

0 comments on commit 43ea696

Please sign in to comment.