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

From: Date: Sat, 12 May 2007 15:47:23 +0000
Subject: #41375 [Opn->Bgs]: substr() undocumented behavior change from 5.2.1 to 5.2.2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112581@lists.php.net to get a copy of this message
 ID:               41375
 Updated by:       iliaa@php.net
 Reported By:      bugs dot php dot net at kreidenweis dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Linux
 PHP Version:      5.2.2
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

.


Previous Comments:
------------------------------------------------------------------------

[2007-05-12 12:52:22] bugs dot php dot net at kreidenweis dot com

Description:
------------
substr() handled a negative $start parameter with an absolute value
larger than the $string's length gracefully and sensibly up to PHP
5.2.1

In 5.2.2 this behavior changed without that being mentioned in the
documentation.

IMHO it probably has something to do with the fix for
http://bugs.php.net/bug.php?id=40754

I guess (and hope ;) the behavior change wasn't intended. But if indeed
so, please put a warning in the documentation.

Reproduce code:
---------------
var_dump(substr('abc', -4));

Expected result:
----------------
string(3) "abc"

(up to PHP 5.2.1 this is what happens)

Actual result:
--------------
bool(false)

(output by PHP 5.2.2)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41375&edit=1


Thread (5 messages)

« previous php.bugs (#112581) next »