Bug #76197 [Opn->Fbk]: White space not returned by substr
| From: | peehaa@php.net | Date: | Sun, 08 Apr 2018 16:07:55 +0000 |
| Subject: | Bug #76197 [Opn->Fbk]: White space not returned by substr | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214648@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76197&edit=1
ID: 76197
Updated by: peehaa@php.net
Reported by: laurent dot couraud at c2n dot upsaclay dot fr
Summary: White space not returned by substr
-Status: Open
+Status: Feedback
Type: Bug
Package: Strings related
Operating System: Windows
PHP Version: 7.2.4
Block user comment: N
Private report: N
New Comment:
How did you test this behavior? As I get the expected result:
https://3v4l.org/RQ8EM
<?php
$string = 'a b';
$c1 = substr($string, 1, 1);
$c2 = mb_substr($string, 1, 1);
$c3 = iconv_substr($string, 1, 1);
var_dump($c1, $c2, $c3);
Previous Comments:
------------------------------------------------------------------------
[2018-04-08 16:03:12] laurent dot couraud at c2n dot upsaclay dot fr
Description:
------------
all string related function i did test (substr, mb_substr, iconv_substr) return a empty string when
the result should be one space character.
Test script:
---------------
// Source code saved in UTF-8 encoding.
$string = 'a b';
$c1 = substr($string, 1, 1);
$c2 = mb_substr($string, 1, 1);
$c3 = iconv_substr($string, 1, 1);
// then we obtain:
// $c1 == $c2 == $c3 == ""
// instead of
// $c1 == $c2 == $c3 == " "
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76197&edit=1