Doc #53935 [ReO->Csd]: Wrong Return Value for substr()

From: Date: Thu, 10 Feb 2011 15:32:53 +0000
Subject: Doc #53935 [ReO->Csd]: Wrong Return Value for substr()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5966@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53935&edit=1 ID: 53935 Updated by: vrana@php.net Reported by: miqrogroove at gmail dot com Summary: Wrong Return Value for substr() -Status: Re-Opened +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: Linux PHP Version: 5.2.17 Assigned To: vrana Block user comment: N Private report: N New Comment: Old changelog was wrong. substr("abc", -7) returns "abc" in PHP 5.1.6. Previous Comments: ------------------------------------------------------------------------ [2011-02-10 13:11:54] salathe@php.net The changelog used to refer to the behaviour in cases such as substr('abc',2,-2). As detailed in the changelog before today's amendment, prior to 5.2.2 that case returns an empty string and otherwise returns false. The change in behaviour for the substr('abc',-7) case should be detailed separately. ------------------------------------------------------------------------ [2011-02-10 12:36:15] vrana@php.net This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. 5.2.2 - 5.2.6: ... Other versions get the string from start. ------------------------------------------------------------------------ [2011-02-10 12:35:48] vrana@php.net Automatic comment from SVN on behalf of vrana Revision: http://svn.php.net/viewvc/?view=revision&revision=308179 Log: Changelog (doc bug #53935) ------------------------------------------------------------------------ [2011-02-05 22:38:43] miqrogroove at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.substr#Changelog --- According to the "Changelog" this function should return FALSE for substr('abc', - 7) in 5.2.2+. The actual return value is 'abc' in version 5.2.16. Did not test 5.2.17, but the manual is obviously wrong. Test script: --------------- echo substr('abc', -7); Expected result: ---------------- No output. Actual result: -------------- abc ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53935&edit=1

« previous php.doc.bugs (#5966) next »