|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-29 23:32 UTC] jani@php.net
[2007-07-30 01:07 UTC] fznohluwlempsh at mailinator dot com
[2007-07-30 14:22 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 03:00:02 2025 UTC |
Description: ------------ After upgrading from 5.2.1 to 5.2.3, my app broke. Why? Because I had the audacity to use substr_replace() in a perfectly reasonable way. This isn't rocket science. If $length is longer than the length of $string, substr_replace() should return the same as if $length was not given. It should not return FALSE. Hell, it doesn't even return FALSE if you specify the string 'blow me' as $length. Fuck the what? And don't even think about giving me the standard bullshit "please double-check the documentation" non-answer that bug report #41395 got on this same issue. I triple-checked the documentation, and nowhere did it say, "Oh, and now it sometimes returns FALSE for no fucking reason. Sit and spin -- we'll break compatibility in sub-point releases whenever we goddamn want." Reproduce code: --------------- <?php var_dump(substr_replace('12345', 'abc', 3)); var_dump(substr_replace('12345', 'abc', 3, 3)); var_dump(substr_replace('12345', 'abc', 3, 4)); var_dump(substr_replace('12345', 'abc', 3, 5)); var_dump(substr_replace('12345', 'abc', 3, 6)); Expected result: ---------------- string(6) "123abc" string(6) "123abc" string(6) "123abc" string(6) "123abc" string(6) "123abc" Actual result: -------------- string(6) "123abc" string(6) "123abc" string(6) "123abc" string(6) "123abc" bool(false) <-- This shit is broke!