php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #6680 regexps (ereg*) ignores locale settings
Submitted: 2000-09-12 05:54 UTC Modified: 2010-08-07 01:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mbravo at tag-ltd dot spb dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.0.1pl2 OS: FreeBSD 4.1-RELEASE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
29 + 30 = ?
Subscribe to this entry?

 
 [2000-09-12 05:54 UTC] mbravo at tag-ltd dot spb dot ru
<?php
 
if(eregi("^[[:alnum:]]+$",$t1)) {
  printf("alnum<br>");
} else {
  printf("not alnum<br>");
}
 
?>

when invoked with $t1=<some string in cyrillic koi8-r encoding> (example - "????") and correct locale settings (see below) prints "not alnum"

while at the command line grep -E with the same input matches:

    -------
mbravo@tag-ltd:pages$ grep -E '[[:alnum:]]+'
????
????
    -------


PHP configured as - 

'./configure' '--prefix=/opt/www' '--with-apxs=/opt/www/bin/apxs'
'--with-mod_charset' '--with-mysql=/opt' '--with-pgsql=/opt'

posix
Revision                                            $Revision: 1.17 $

LANG  ru_RU.KOI8-R
HTTP_ENV_VARS["LANG"] ru_RU.KOI8-R


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-17 16:30 UTC] stas@php.net
You may want to use PCRE extension - it supports locale settings.
 [2001-08-31 06:32 UTC] sander@php.net
Moved to feature request.
 [2010-08-07 01:44 UTC] johannes@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-08-07 01:44 UTC] johannes@php.net
ereg is deprecated in favor of preg
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 19:01:31 2024 UTC