Bug #78101 [Nab]: Icorrect behaviour for substr on Windows
| From: | mishamosher at gmail dot com | Date: | Mon, 03 Jun 2019 20:55:31 +0000 |
| Subject: | Bug #78101 [Nab]: Icorrect behaviour for substr on Windows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221102@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78101&edit=1
ID: 78101
User updated by: mishamosher at gmail dot com
Reported by: mishamosher at gmail dot com
Summary: Icorrect behaviour for substr on Windows
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Windows 10 1903 64-bits
PHP Version: 7.2.19
Block user comment: N
Private report: N
New Comment:
Hello requinix@php.net,
I appreciate your attention into the matter.
I know for sure that there are no multibyte strings or invisible characters in my testing. Functions
strlen, mb_strlen and mb_detect_encoding return 3, 3 and "ASCII" respectively.
In the mantime, I've just finished configuring PHP 7.2.11 and PHP 7.3.6, as Apache modules, and
they both do not exibit this issue with the very same test file and test environment.
The real mistery for me is why specifically PHP 7.2.19 does not want to work as it should. Please
note that the issue presents itself only when I run PHP 7.2.19 as an Apache module. The issue does
not occur when I run PHP via CMD (php.exe -f script.php).
Is there any specific test or debug information that I can provide to further identify the issue?
Previous Comments:
------------------------------------------------------------------------
[2019-06-03 19:23:35] requinix@php.net
Either you typed an invisible character (copy/pasted a BOM?) or that slash is a Unicode slash made
up of multiple bytes.
If you intend to support multibyte strings and non-ASCII encodings then use mbstring and mb_substr()
instead.
------------------------------------------------------------------------
[2019-06-03 18:48:45] mishamosher at gmail dot com
Description:
------------
I am trying this simple code:
<?php
echo substr("/es", 0, 1);
?>
I expect to see a "/" as a result, but I get "�" instead.
PHP is running in an entirely 64-bit environment.
- Windows 10 1903
- PHP 7.2.19 (as an apache module)
- Apache 2.4.39
Running PHP from the console (php.exe -f script.php) functions properly.
Test script:
---------------
<?php
echo substr("/es", 0, 1);
?>
Expected result:
----------------
"/"
Actual result:
--------------
"�"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78101&edit=1