Bug #69931 [Opn]: substr() behaviour change

From: Date: Thu, 25 Jun 2015 08:48:59 +0000
Subject: Bug #69931 [Opn]: substr() behaviour change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193873@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69931&edit=1 ID: 69931 Updated by: thekid@php.net Reported by: thekid@php.net Summary: substr() behaviour change Status: Open Type: Bug Package: Strings related Operating System: Ubuntu PHP Version: 7.0Git-2015-06-25 (Git) Block user comment: N Private report: N New Comment: I believe this is what's causing the change: @@ -2406,7 +2407,7 @@ PHP_FUNCTION(substr) } } - if (f >= (zend_long)str->len) { + if (f > (zend_long)str->len) { RETURN_FALSE; } ...which was introduced in 257054e81d4dad73bf9d09cd206d3a6727ad1777 to fix #62922 Hrm. Previous Comments: ------------------------------------------------------------------------ [2015-06-25 08:44:51] thekid@php.net Description: ------------ The substr() function behaves differently in a current PHP7 than e.g. in alpha1 Test script: --------------- substr("Hello", 5, 1) Expected result: ---------------- false Actual result: -------------- "" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69931&edit=1

« previous php.bugs (#193873) next »