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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Thu Dec 26 15:01:32 2024 UTC