#23794 [Bgs]: Recurrance of bug #3269

From: Date: Sun, 25 May 2003 00:43:39 +0000
Subject: #23794 [Bgs]: Recurrance of bug #3269
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40362@lists.php.net to get a copy of this message
ID: 23794 User updated by: kelly dot mctiernan at verizon dot net Reported By: kelly dot mctiernan at verizon dot net Status: Bogus Bug Type: Scripting Engine problem Operating System: Solaris 8 PHP Version: 4.3.1 New Comment: You're absolutely right; I discovered the problem right before you responded. It's a bug in the Solaris dos2unix. The display is a vi interpretation of undisplayable characters (when you move over then, the cursor jumps over the entire \nnn). I re-ran dos2unix on Linux before the port, and I now see: $html_text = preg_replace("/[^a-zA-Z\340-\377\300-\337$numbers ]/"," ",$html_text); which works beatifully! My appologies. I'm a programmer as well, and should have spotted that. I do mostly Perl and Java - not much PHP - but that's still no excuse (especially since Perl and PHP regexp's are so similar). Anyway, an obscure caveat comes from all of this: DON'T RUN SOLARIS DOS2UNIX ON A PHP SOURCE FILE (IT CAN BREAK EXTENDED CHAR SET REPRESENTATIONS)!!! Previous Comments: ------------------------------------------------------------------------ [2003-05-24 19:27:29] moriyoshi@php.net The regex line is simply wrong and it shouldn't work in any situation. [^a-zA-Z\200-\220\301-\236$numbers ]/ ^^^^^^^^^ A character class should be represented by a sequence of any character, a hyphen and a character with character code greater than the first. (\236 is not greater than \301) I guess \236 is a typo of \336. ------------------------------------------------------------------------ [2003-05-24 19:06:48] kelly dot mctiernan at verizon dot net I'm sorry, it appears to be behavig correctly. This test was copied directly from bug report #3269, which was the only problem I found regarding Solaris/preg_replace. I should have investigated more closely. Anyway, my problem is I'm getting the following error: Warning: Compilation failed: range out of order in character class at offset 13 in /usr/local/apache/htdocs/kbstudio/admin/map_site.php on line 168 line 168 is $html_text = preg_replace("/[^a-zA-Z\200-\220\301-\236$numbers ]/"," ",$html_text); This exact script behaves beautifully on Linux with the exact same configuration. Also my phpshop is giving strange warnings. I'm using gcc 2.95 on Solaris to complile and gcc 3.0 on Linux. Perhaps that's the issue? ------------------------------------------------------------------------ [2003-05-24 18:19:44] moriyoshi@php.net The output you pasted here doesn't seem to indicate any problem and is obviously different to the one described in bug #3269.. So what's your problem? ------------------------------------------------------------------------ [2003-05-24 18:06:32] kelly dot mctiernan at verizon dot net This is my configuration: ./configure --with-mysql=/usr/local/mysql/ --with-apxs=/usr/local/apache/bin/apxs --with-curl=/usr/local/ ------------------------------------------------------------------------ [2003-05-24 17:51:32] kelly dot mctiernan at verizon dot net I am experincing the exact same behavior as described in bug report #3269 on Solaris 8/PHP 4.3.1/Apache 1.3.27. i.e: <? $regexes = array("/(bold)/i", "/(something)/"); $text = "This is really something to see! A bold new achievement in the world of bugs. Not to mention something that I probably misspeled there. Woo hoo!"; $new = preg_replace($regexes, "<B>\\1</B>", $text); print $new; ?> Result: This is really <B>something</B> to see! A <B>bold</B> new achievement in the world of bugs. Not to mention <B>something</B> that I probably misspeled there. Woo hoo! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23794&edit=1

« previous php.bugs (#40362) next »