Bug #62703 [Opn->Wfx]: substr() length=null

From: Date: Wed, 01 Aug 2012 02:00:09 +0000
Subject: Bug #62703 [Opn->Wfx]: substr() length=null
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-172362@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62703&edit=1 ID: 62703 Updated by: aharvey@php.net Reported by: spam02 at live dot com Summary: substr() length=null -Status: Open +Status: Wont fix Type: Bug Package: Strings related Operating System: Linux PHP Version: 5.3.15 Block user comment: N Private report: N New Comment: This is documented behaviour: if the length parameter weakly evaluates to int(0), false, null or an empty string may be returned. We can't fix this without a BC break, and I don't think it's worth it, personally. Previous Comments: ------------------------------------------------------------------------ [2012-07-31 14:38:15] laruence@php.net yeah, null also can be considered as 0, so, this is a little confused. the fix will be easy, however fixing this might introduce bc break(not sure) ------------------------------------------------------------------------ [2012-07-31 11:17:46] spam02 at live dot com Description: ------------ seems null = not empty in mb_substr()... //example $text = 'test'; mb_substr($text,-1); //result t mb_substr($text,-1,null) //result '' expected t substr($text,-1); //result t substr($text,-1, null) //result '' expected t php version 5.3.3-7+squeeze13 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62703&edit=1

« previous php.bugs (#172362) next »