#25669 [Opn->Csd]: eregi() vs. 8-bit chars in regex

From: Date: Wed, 01 Oct 2003 09:21:11 +0000
Subject: #25669 [Opn->Csd]: eregi() vs. 8-bit chars in regex
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-48371@lists.php.net to get a copy of this message
ID: 25669 Updated by: moriyoshi@php.net Reported By: svs at ropnet dot ru -Status: Open +Status: Closed Bug Type: Regexps related Operating System: FreeBSD 4.8 PHP Version: 4.3.3 New Comment: Ok, I'm closing the bug. Thanks for helping make php better. (The fix will go to 4.3.4-rc2 or later versions) Previous Comments: ------------------------------------------------------------------------ [2003-10-01 04:41:21] svs at ropnet dot ru This template is a complete test case actually. I did not have to modify it in any way. ------------------------------------------------------------------------ [2003-09-29 12:11:56] moriyoshi@php.net Yup, if possible. The following is just a template (supposed to be put in ext/standard/tests/reg). Please try to avoid using non-ascii characters in the test case. Thanks in advance. --TEST-- Bug #25669 (eregi() with non-ascii characters) --SKIP-- <?php setlocale(LC_ALL, "de_DE.ISO8859-1") || die('SKIP de_DE.ISO8859-1 locale not sup ported by this system'); ?> --FILE-- <?php setlocale(LC_ALL, "de_DE.ISO8859-1"); var_dump((bool)eregi("\xc4\xcb\xf6", "\xe4\xeb\xd6")); var_dump((bool)eregi("\xc4", "\xe1")); var_dump((bool)preg_match("/\xc4\xcb\xf6/i", "\xe4\xeb\xd6")); var_dump((bool)preg_match("/\xc4/i", "\xe1")); ?> --EXPECT-- bool(true) bool(false) bool(true) bool(false) ------------------------------------------------------------------------ [2003-09-29 12:03:34] svs at ropnet dot ru This one is OK. Should I write a test case? ------------------------------------------------------------------------ [2003-09-29 11:17:04] moriyoshi@php.net Can you try this one again: http://www.voltex.jp/patches/regpatch.diff Note: This problem is known to not be reproduced with glibc and unfortunately I don't have a freebsd box atm. ------------------------------------------------------------------------ [2003-09-29 08:08:38] moriyoshi@php.net Ilia: your patch doesn't seem to deal with it correctly, as isalpha() expects signed integer indeed. A char value can be any of the numbers, -128 to 127, so if you cast it to unsigned integer, you never got a value in range of 0 to 255. So you should first cast it to unsigned char, and then make it signed integer. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25669 -- Edit this bug report at http://bugs.php.net/?id=25669&edit=1

« previous php.bugs (#48371) next »