|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52592 mb_ereg_replace and the Greek capital Pi
Submitted: 2010-08-12 14:36 UTC Modified: 2010-08-13 06:50 UTC
From: pj at ezgr dot net Assigned:
Status: Not a bug Package: mbstring related
PHP Version: 5.2.14 OS: Centos 5.5 x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: pj at ezgr dot net
New email:
PHP Version: OS:


 [2010-08-12 14:36 UTC] pj at ezgr dot net
PHP: 5.2.14, Apache 2.2.15, mod_php

While \s is supposed to match all whitespace, the greek unicode letter Pi (Π) whose code is 0xCEA0 is matched too and if replaced with something, it's stripped of its second byte (0xA0).

Test script:

$testStr = 'Π  Π  Π!';
$newStr = mb_ereg_replace('\s+','_',$testStr);
echo $testStr;
echo $newStr;
echo urlencode($testStr);
echo urlencode($newStr);

Expected result:
Π  Π  Π!

Actual result:
Π  Π  Π!
[non printable character]_[non printable character]_[non printable character]!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-13 06:50 UTC]
-Status: Open +Status: Bogus
 [2010-08-13 06:50 UTC]
You need to also call mb_regex_encoding('UTF-8'); before using a UTF-8 regular expression.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 09:01:27 2024 UTC