From:             slunta at msn dot com
Operating system: Linux
PHP version:      4.3.6
PHP Bug Type:     Output Control
Bug description:  line breaks in textareas forces preg_replace to quit

Description:
------------
I don't know why, or how, but it appears that a line break in a textarea
will cause a preg_replace to quit. Let me show you the code and the page
so you can test it and see for yourself what I'm talking about.

You can find the page with the code at:

http://turkeybot.olddh.com/bug.php

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

$message=isset($_POST['message']) ? htmlentities($_POST['message']) :'';

$array1=array('/&lt;b&gt;(.+)&lt;\/b&gt;/','/&lt;i&gt;(.+)&lt;\/i&gt;/','/&lt;u&gt;(.+)&lt;\/u&gt;/');
$array2=array('<b>$1</b>','<i>$1</i>','<u>$1</u>');
$mess=preg_replace($array1,$array2,$message);

echo '<html>
<form action="bug.php" method="post">
' .$mess. '
<textarea name="message" cols="40" rows="10"></textarea>
<input type="submit" name="post" value="Post" /><input type="reset"
name="reset" value="Reset" /></form>';

?>

Expected result:
----------------
When I post the data, I always expect to see my <b>,<i>,and<u> tags to run
correctly and display the message with the proper html.

Actual result:
--------------
The preg_replace fails in replacing the entities with the proper tags once
a line break is inserted into the textarea.

-- 
Edit bug report at http://bugs.php.net/?id=28886&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28886&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28886&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28886&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28886&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28886&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28886&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28886&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28886&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28886&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28886&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28886&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28886&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28886&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28886&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28886&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28886&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28886&r=float

Reply via email to