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
 [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: Tue Apr 16 22:01:27 2024 UTC