php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jacky at xsteach dot com
New email:
PHP Version: OS:

 

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

Test script:
---------------
<?php

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


// 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] requinix@php.net
-Status: Closed +Status: Not a bug -Package: PHP Language Specification +Package: Strings related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 08:01:28 2024 UTC