Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.0a3

Doc Bug #15540 htmlspecialchars has incorrect "since"
Submitted: 2009-01-07 15:05 UTC
From: hm2k Assigned: arpad
Status: Closed Package: PHP_Compat (version 1.6.0a2)
PHP Version: 5.2.8 OS:
Roadmaps: 1.6.0a3    
Subscription  


 [2009-01-07 15:05 UTC] hm2k (James Wade)
Description: ------------ * @since PHP 5.1.0 should be: * @since PHP 4 This also raises a question about: * @require PHP 4.0.0 (user_error) Surly if htmlspecialchars() is included in PHP4 and it requires PHP4 this is null?

Comments

 [2009-01-19 18:10 UTC] hm2k (James Wade)
I am under the impression that this should be removed, as it is a null compat and will never be used. Will remove in 4 days time unless action is challenged. Can be reverted anyway.
 [2009-01-24 02:21 UTC] arpad (Arpad Ray)
I'm guessing that's meant to read 4.1.0/5.2.3 but the whole thing does seem rather redundant at the moment. We can support $double_encode properly with a preg_replace and perhaps $charset (are we dependent on mb for that?).
 [2009-01-24 12:20 UTC] hm2k (James Wade)
The htmlspecialchars() function has existed in PHP since PHP4, so there's no point rebuilding it, and certainly no point in the "define". "charset" since 4.1.0, which can't be supported without mb. "double_encode" since 5.2.3, isn't correctly supported at all. At the very most you'd need a wrapper to support these, but at the core it would always call htmlspecialchars. As far as I can see there's no realistic scenario this function would be found useful. Next action is to remove it.
 [2009-01-24 13:15 UTC] aidan (Aidan Lister)
Both of those params should be supported as best we can via the php_compat_htmlspecialchars wrapper, as we've done for other PHP 4.0.0 functions that have had parameter changes.
 [2009-01-24 15:33 UTC] hm2k (James Wade)
I'm thinking that php_compat_htmlspecialchars() should simply call htmlspecialchars() then apply the other properties? However, back the original issue, are we agreeing that since should be PHP4?
 [2009-01-24 23:00 UTC] arpad (Arpad Ray)
I've committed an implementation which supports $double_encode and $charset (if mb is available). I'm not sure the fancy mb support is necessary at all to replicate htmlspecialchars(), since unless I'm mistaken none of the supported charsets actually conflict with the characters operated on (there's no multi-byte characters in those charsets with a byte below 0x40). Still, better safe than sorry.