php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3774 ereg doesn't use locale
Submitted: 2000-03-08 14:15 UTC Modified: 2000-03-08 14:28 UTC
From: runesk at radar dot no Assigned:
Status: Closed Package: Other
PHP Version: 3.0.15 OS: RedHat Linux 2.2.5-15
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: runesk at radar dot no
New email:
PHP Version: OS:

 

 [2000-03-08 14:15 UTC] runesk at radar dot no
<?php
$foo = "???";

if(preg_match("/\w+/", $foo, $bar)) {
  echo "preg_match default locale => Match\n";
} else {
  echo "preg_match default locale => No Match\n";
}
if(ereg("[[:alnum:]]+", $foo, $bar)) {
  echo "ereg       default locale => Match\n";
} else {
  echo "ereg       default locale => No Match\n";
}
 
setlocale("LC_CTYPE", "no_NO");

if(preg_match("/\w+/", $foo, $bar)) {
  echo "preg_match  no_No  locale => Match\n";
} else {
  echo "preg_match  no_No  locale => No Match\n";
}
if(ereg("[[:alnum:]]+", $foo, $bar)) {
  echo "ereg        no_No  locale => Match\n";
} else {
  echo "ereg        no_No  locale => No Match\n";
}
?>

produses following output:
preg_match default locale => No Match
ereg       default locale => No Match
preg_match  no_No  locale => Match
ereg        no_No  locale => No Match

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-08 14:28 UTC] runesk at radar dot no
same as 1430
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 03:00:02 2026 UTC