Bug #76197 [Fbk->Nab]: White space not returned by substr
Edit report at https://bugs.php.net/bug.php?id=76197&edit=1
ID: 76197
Updated by: aharvey@php.net
Reported by: laurent dot couraud at c2n dot upsaclay dot fr
Summary: White space not returned by substr
-Status: Feedback
+Status: Not a bug
Type: Bug
Package: Strings related
Operating System: Windows
PHP Version: 7.2.4
Block user comment: N
Private report: N
New Comment:
Closing, given the last comment.
Previous Comments:
------------------------------------------------------------------------
[2018-04-08 18:22:15] laurent dot couraud at c2n dot upsaclay dot fr
Oops! Good point. this is not a bug in PHP but in xdebug.
Sorry for the noise.
------------------------------------------------------------------------
[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
Thread (4 messages)