php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73669 iconv_substr not work correctly
Submitted: 2016-12-06 16:52 UTC Modified: 2016-12-08 01:41 UTC
From: axot at axot dot org Assigned: cmb (profile)
Status: Closed Package: ICONV related
PHP Version: 7.0.13 OS: Mac
Private report: No CVE-ID: None
 [2016-12-06 16:52 UTC] axot at axot dot org
Description:
------------
If str is shorter than offset characters long, FALSE will be returned.
But string(0) returned.

Test script:
---------------
<?php
var_dump(iconv_substr('20', 2, 1));
?>

Expected result:
----------------
bool(false)

Actual result:
--------------
string(0) ""

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-07 14:27 UTC] cmb@php.net
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Package: *General Issues +Package: ICONV related -Assigned To: +Assigned To: cmb
 [2016-12-07 14:27 UTC] cmb@php.net
To match the behavior of substr() and mb_substr() in PHP 7, iconv_substr() has been fixed as of PHP 7.0.11 (see bug #72320 and <https://3v4l.org/qhP6H>). This has not been documented, however.
 [2016-12-07 14:42 UTC] axot at axot dot org
I think this is a different case to #72320, I test this code both in 7.0.13 and 7.1.0. All of the 2 version failed.
 [2016-12-07 14:48 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=341328
Log: Fix #73669: iconv_substr not work correctly
 [2016-12-07 14:50 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-12-07 14:50 UTC] cmb@php.net
> I think this is a different case to #72320, […]

This is not a different case as #72320, but rather due to fixing #72320, the behavior has changed in PHP 7.0.11.
 [2016-12-07 14:58 UTC] axot at axot dot org
Thank you for the information, should I think this is not a bug now, it just not been document. So I can trust the new behavior ?
 [2016-12-07 15:08 UTC] cmb@php.net
I have already committed the respective changes to the documentation: <http://svn.php.net/viewvc/?view=revision&amp;revision=341328>. It will take a while until this commit is rolled out to the PHP manual on all mirrors, though.
 [2016-12-08 01:41 UTC] axot at axot dot org
Thank you for updating the documentation.
 [2020-02-07 06:06 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=476aeff94809cf6e438a7dec55b193d6eddcc0b4
Log: Fix #73669: iconv_substr not work correctly
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC