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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mbravo at tag-ltd dot spb dot ru
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sun Dec 22 01:01:30 2024 UTC