|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-10 07:03 UTC] derick@php.net
[2012-03-19 00:00 UTC] harald dot lapp at gmail dot com
[2018-10-01 23:30 UTC] arnold at jasny dot net
[2019-05-23 18:10 UTC] phpbugreport888 at allanid dot com
[2020-10-01 12:04 UTC] thomas at landauer dot at
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 23:00:01 2025 UTC |
Description: ------------ When using preg_match_all() with the PREG_OFFSET_CAPTURE flag, the returned match offsets are in octets rather than characters. PCRE is compiled with --enable-utf8 and I am using the u modifier in my regular expression. Reproduce code: --------------- <?php $matches = array(); $reg_exp = "/B/u"; // UTF8 represents A-euro-BC $string = "A\xe2\x82\xacBC"; preg_match_all($reg_exp, $string, $matches, PREG_OFFSET_CAPTURE); print_r($matches); ?> Expected result: ---------------- Array ( [0] => Array ( [0] => Array ( [0] => B [1] => 2 ) ) ) Actual result: -------------- Array ( [0] => Array ( [0] => Array ( [0] => B [1] => 4 ) ) )