|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-24 22:19 UTC] cataphract@php.net
[2012-03-24 22:19 UTC] cataphract@php.net
-Status: Open
+Status: Wont fix
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 03:00:01 2025 UTC |
Description: ------------ One would expect that when the optional $flags of htmlspecialchars() is set to null, the behavior is the same as when the parameter is not set, so the default value is used. This would be useful when someone wants to set another optional parameter. For instance, to set the $double_encode parameter: htmlspecialchars("some text", null, null, false); Comment: This is a bug similar to #40531 "mb_substr optional parameters". Other functions probably behave the same. The difficulty is that zend_parse_argument() cannot deal with the complex type "long or null", so extra parsing and validating is needed. First tested on PHP 5.3.10, but same problem on 5.4.0. Test script: --------------- echo htmlspecialchars("l'été \"dernier\"\n"); echo htmlspecialchars("l'été \"dernier\"\n", null); echo htmlspecialchars("l'été \"dernier\"\n", 0); Expected result: ---------------- l'été "dernier" l'été "dernier" l'été "dernier" Actual result: -------------- l'été "dernier" l'été "dernier" l'été "dernier"