#20631 [Opn->Ver]: PCRE_CASELESS doesn't work

From: Date: Thu, 28 Nov 2002 14:53:50 +0000
Subject: #20631 [Opn->Ver]: PCRE_CASELESS doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26100@lists.php.net to get a copy of this message
ID: 20631 Updated by: iliaa@php.net Reported By: matt@zevi.net -Status: Open +Status: Verified Bug Type: PCRE related Operating System: Linux 2.4.19 PHP Version: 4.3.0RC1 New Comment: This is indeed a bug, you are correct. The bug is due to us bundling a pcre library which appears to have a bug, which causes the behaviour you describe. As an intermittent solution, you can compile your own pcre library and compile php with --with-pcre-regex=/path/to/pcre/lib Previous Comments: ------------------------------------------------------------------------ [2002-11-27 19:26:19] matt@zevi.net Forgot to change back to open... ------------------------------------------------------------------------ [2002-11-27 19:25:35] matt@zevi.net I respectfully disagree... :) My code definitely was case-insensitive in 4.2.2 and 4.2.3, and when I installed 4.3.0RC1 it was case-sensitive. There's definitely something fishy going on. The following page details the setting of internal options by using the (?) construct. http://www.php.net/manual/en/pcre.pattern.syntax.php#regexp.reference.internal-options According to this page, what I'm doing is correct. I really don't mind changing my function to use perhaps eregi_replace or something else, but I really think this could be an issue for users who currently use preg_* functions with case-insensitivity (I'm sure there would be a few of them...) Matt ------------------------------------------------------------------------ [2002-11-27 00:22:41] iliaa@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Unless you specify the 'i' flag your regular expression will NOT be case-insensetive. For example the regex you've shown should appear like this: '/\(name\)(?i)/i' If you want it not to be case sensetive. ------------------------------------------------------------------------ [2002-11-25 16:50:48] matt@zevi.net preg_replace(): This regex was case insensitive in 4.2.3, but is case sensitive in 4.3.0RC1: '/\(name\)(?i)/' Was not able to test further because I installed it on a production box, and had to revert to 4.2.3... I had the search and replace values in arrays which I then passed to preg_replace(). This may have some effect on it. I didn't test just passing a string. Matt ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20631&edit=1

« previous php.bugs (#26100) next »