|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71301 substr function behavior changed not documented
Submitted: 2016-01-07 10:35 UTC Modified: 2016-01-07 11:15 UTC
From: jacky at xsteach dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 7.0.1 OS: MacOSX 10.11.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jacky at xsteach dot com
New email:
PHP Version: OS:


 [2016-01-07 10:35 UTC] jacky at xsteach dot com
The behavior of substr function have been changed on php 7, but not mention on the document.

Test script:

$s = substr('str',3);

// result on php 5.x
// bool(false)

// result on php 7
// string(0) ""

Expected result:
have the same result

Actual result:
the return type not compatible.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-07 10:40 UTC] jacky at xsteach dot com
-Status: Open +Status: Closed
 [2016-01-07 10:40 UTC] jacky at xsteach dot com
my mistake.sorry!
 [2016-01-07 11:15 UTC]
-Status: Closed +Status: Not a bug -Package: PHP Language Specification +Package: Strings related
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Oct 04 14:01:25 2023 UTC