php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54240 mb_ereg_search_getpos() counts umlauts twice
Submitted: 2011-03-13 08:33 UTC Modified: 2012-06-20 23:16 UTC
From: phpbug at ymail dot com Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 5.2.17 OS:
Private report: No CVE-ID: None
 [2011-03-13 08:33 UTC] phpbug at ymail dot com
Description:
------------
mb_ereg_search_getpos() seems to count German umlauts twice. See test script.

Test script:
---------------
mb_regex_encoding('UTF-8');

$test1 = "ab";
$test2 = "ääb";
$test3 = "äääb";

mb_ereg_search_init($test1, "b");
mb_ereg_search();
echo "Test1: " . mb_ereg_search_getpos(); // Result: 2

mb_ereg_search_init($test2, "b");
mb_ereg_search();
echo "Test2: " . mb_ereg_search_getpos(); // Result: 5 (should be "3")

mb_ereg_search_init($test3, "b");
mb_ereg_search();
echo "Test3: " . mb_ereg_search_getpos(); // Result: 7 (should be "4")


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-20 23:16 UTC] patrickallaert@php.net
-Status: Open +Status: Not a bug
 [2012-06-20 23:16 UTC] patrickallaert@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

As mentioned in the documentation:
"The position is represented by bytes from the head of string."
and as such this is the expected behavior.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC