ID:               33437
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at karsites dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         PCRE related
 Operating System: SuSE Linux 9.2 pro
 PHP Version:      4.3.10
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip




Previous Comments:
------------------------------------------------------------------------

[2005-06-22 17:47:26] php at karsites dot net

Description:
------------
I'm actually on php4-4.3.8-8.7 - stuck with that at the 
moment,as that ships with my Linux distro - SuSE 9.2 pro  
  
I did search the database for 'coments' but found nothing 
there regarding this possible bug. 
 
The code below trashes the script with the   
commented line in the script  
  
// original regex $regex = "!(</?)(\w+)([^>]*?>)!e";  
  
Surely, everything to the right of // should be ignored  
as a comment?  
  
With the comment in place, the script produces the  
following trashed output:  
  
)!e"; $regex = "!(]*?>)!e"; $replacement =  
"'\\1'.strtolower('\\2').'\\3'"; $subject = " A rose"; echo  
"Before replacement \$subject is: $subject   
"; $new_sub = preg_replace($regex, $replacement, $subject);  
echo "After replacement \$subject is: $new_sub   
"; ?>  
  
Is this a bug, because it is not expected behaviour.  
  
If I remove the offending comment, the script produces the  
correct output.  
  
Regards - Keith Roberts  
  
  

Reproduce code:
---------------
<?php

// original regex $regex = "!(</?)(\w+)([^>]*?>)!e";

$regex = "!(</?)(\w+)([^>]*?>)!e";

$replacement = "'\\1'.strtolower('\\2').'\\3'";

$subject = "<BIGTEXT> A <BIGGEST>rose</BIGGEST> <PARA></BIGTEXT>";

echo "Before replacement \$subject is: $subject <br />";

$new_sub = preg_replace($regex, $replacement, $subject);
echo "After replacement \$subject is: $new_sub <br />";

?>



Expected result:
----------------
Before replacement $subject is: A rose 
After replacement $subject is: A rose  
 
(the browser ignores the dummy tags, but the correct result 
can be seen with 'view source code' - ie lowercased tags) 
 
 

Actual result:
--------------
 
)!e"; $regex = "!(]*?>)!e"; $replacement = 
"'\\1'.strtolower('\\2').'\\3'"; $subject = " A rose"; echo 
"Before replacement \$subject is: $subject  
"; $new_sub = preg_replace($regex, $replacement, $subject); 
echo "After replacement \$subject is: $new_sub  
"; ?> 
 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33437&edit=1

Reply via email to