Bug #76197 [Com]: White space not returned by substr
| From: | laurent dot couraud at c2n dot upsaclay dot fr | Date: | Sun, 08 Apr 2018 18:22:17 +0000 |
| Subject: | Bug #76197 [Com]: White space not returned by substr | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214652@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
Comment by: laurent dot couraud at c2n dot upsaclay dot fr
Reported by: laurent dot couraud at c2n dot upsaclay dot fr
Summary: White space not returned by substr
Status: Feedback
Type: Bug
Package: Strings related
Operating System: Windows
PHP Version: 7.2.4
Block user comment: N
Private report: N
New Comment:
Oops! Good point. this is not a bug in PHP but in xdebug.
Sorry for the noise.
Previous Comments:
------------------------------------------------------------------------
[2018-04-08 16:07:50] peehaa@php.net
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);
------------------------------------------------------------------------
[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