#41375 [Opn]: substr() undocumented behavior change from 5.2.1 to 5.2.2

From: Date: Fri, 07 Sep 2007 15:36:40 +0000
Subject: #41375 [Opn]: substr() undocumented behavior change from 5.2.1 to 5.2.2
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969378065@lists.php.net to get a copy of this message
ID: 41375 Updated by: tony2001@php.net Reported By: bugs dot php dot net at kreidenweis dot com Status: Open Bug Type: Documentation problem Operating System: Any PHP Version: 5.2.2 New Comment: I don't think it's good idea to change it in every release back and forth. Also the current behavior makes much more sense to me. Negative string length is a nonsense, so false is the correct result. Previous Comments: ------------------------------------------------------------------------ [2007-09-07 15:12:40] chagenbu@php.net Yes, of course it should have been caught in the RC stage, but it wasn't - in fact it took me more than one final release to track it down. Why is what's done, done, when the behavior that was changed existed for years and years, and the new behavior has been around for 2 point releases? ------------------------------------------------------------------------ [2007-09-07 14:59:08] tony2001@php.net Don't you think such questions should have been asked during RC stage? It's a bit too late to change it back, what's done is done. ------------------------------------------------------------------------ [2007-09-07 14:46:42] chagenbu@php.net Okay, documenting it at least makes code and documentation consistent, but why the change in the first place? Why not avoid the break and leave it consistent? ------------------------------------------------------------------------ [2007-09-07 09:40:38] jani@php.net Reclassified. ------------------------------------------------------------------------ [2007-09-07 06:48:16] pajoye@php.net "If start is negative, the returned string will start at the start'th character from the end of string." The function still accepts a negative start. What changed is if the start is longer than the string length, the test (user friendly version): if (from > strlen(str) || (from < 0 && -from > strlen(str))) As I agree it may break some scripts, the new behavior should be documented, as a bug fix. Can we move this bug to the doc category? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41375 -- Edit this bug report at http://bugs.php.net/?id=41375&edit=1

« previous php.doc (#969378065) next »