| Summary: | mail/squirrelmail patches to address php5.4 gating issue | ||
|---|---|---|---|
| Product: | Ports & Packages | Reporter: | dewayne |
| Component: | Individual Port(s) | Assignee: | Adam Weinberger <adamw> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Latest | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
dewayne
2013-02-18 04:00:00 UTC
Responsible Changed From-To: freebsd-ports-bugs->adamw Over to maintainer (via the GNATS Auto Assign Tool) State Changed From-To: open->feedback Thanks for sending this. It is a bit tricky to apply their patch because it's against -STABLE, which has over a year's worth of modifications to it, so it can't apply cleanly against the 1.4.22 distfile. I did a pretty lazy version of it, but I don't have a 5.4 machine that I can test this with. I basically added in the new wrapper function, and just did a recursive sed. Please give this a try and tell me how it works for you. I'm putting the patch up at http://people.freebsd.org/~adamw/patches/sm-specialchars.patch because GNATS makes no sense and I don't really understand how to attach files to it. I'll paste it below but I'm sure it'll mangle it. Index: Makefile =================================================================== --- Makefile (revision 312872) +++ Makefile (working copy) @@ -84,6 +84,10 @@ ${WRKSRC}/plugins/fortune/fortune_functions.php @${RM} ${WRKSRC}/plugins/squirrelspell/sqspell_config.php.bak ${WRKSRC}/plugins/fortune/fortune_functions.php.bak + # PHP 5.4 fix: + @for i in `${FIND} ${WRKSRC} -name '*.php' | ${GREP} -v strings.php`; do + ${REINPLACE_CMD} -e 's|htmlspecialchars|sm_encode_html_special_chars|g' $$i; + done # Rearrange the documentation do-build: Index: files/patch-functions_strings.php =================================================================== --- files/patch-functions_strings.php (revision 0) +++ files/patch-functions_strings.php (working copy) @@ -0,0 +1,44 @@ +Index: functions/strings.php +=================================================================== +--- functions/strings.php (revision 14344) ++++ functions/strings.php (working copy) +@@ -1476,4 +1476,39 @@ + + } + ++/** ++ * Wrapper for PHP's htmlspecialchars() that ++ * attempts to add the correct character encoding ++ * ++ * @param string $string The string to be converted ++ * @param int $flags A bitmask that controls the behavior of htmlspecialchars() ++ * (See http://php.net/manual/function.htmlspecialchars.php ) ++ * (OPTIONAL; default ENT_COMPAT) ++ * @param string $encoding The character encoding to use in the conversion ++ * (OPTIONAL; default automatic detection) ++ * @param boolean $double_encode Whether or not to convert entities that are ++ * already in the string (only supported in ++ * PHP 5.2.3+) (OPTIONAL; default TRUE) ++ * ++ * @return string The converted text ++ * ++ */ ++function sm_encode_html_special_chars($string, $flags=ENT_COMPAT, ++ $encoding=NULL, $double_encode=TRUE) ++{ ++ if (!$encoding) ++ { ++ global $default_charset; ++ if ($default_charset == 'iso-2022-jp') ++ $default_charset = 'EUC-JP'; ++ $encoding = $default_charset; ++ } ++ ++// TODO: Is adding this check an unnecessary performance hit? ++ if (check_php_version(5, 2, 3)) ++ return htmlspecialchars($string, $flags, $encoding, $double_encode); ++ ++ return htmlspecialchars($string, $flags, $encoding); ++} ++ + $PHP_SELF = php_self(); Property changes on: files/patch-functions_strings.php ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain No newline at end of property State Changed From-To: feedback->closed SM has been updated to a SVN snapshot that includes 5.4 and 5.5 fixes. Works for me but please re-open this PR if it doesn't work for you. |