|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchessubstr_compare_optlen (last revision 2011-08-18 15:56 UTC by [email protected])Pull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2011-08-18 15:56 UTC] [email protected]
[2016-08-03 09:38 UTC] lauri dot kentta at gmail dot com
[2016-08-07 16:47 UTC] [email protected]
-Summary: substr_compare and case sensitivity
+Summary: substr_compare NULL length interpreted as 0
[2016-08-07 16:51 UTC] [email protected]
[2016-08-07 16:51 UTC] [email protected]
-Status: Open
+Status: Closed
[2016-10-17 10:10 UTC] [email protected]
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Mar 17 10:00:01 2026 UTC |
Description: ------------ The $length parameter of this function is optional in the documentation, but currently it can't be skipped to only set the case sensitivity flag. Values like null or false get converted into 0 which causes a warning and the function returns false. Using null to skip the $length parameter would be nice. Test script: --------------- <?php // should output: 0 echo substr_compare("hello World", "world", 6, null, true), PHP_EOL; ?> Expected result: ---------------- 0 Actual result: -------------- Warning: substr_compare(): The length must be greater than zero