php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27689 preg_replace " glitch
Submitted: 2004-03-25 02:05 UTC Modified: 2004-03-25 09:39 UTC
From: slunta at msn dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.4 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: slunta at msn dot com
New email:
PHP Version: OS:

 

 [2004-03-25 02:05 UTC] slunta at msn dot com
Description:
------------
There is a glitch, that does not allow " to be used in preg_replace, not being replaced at all. Here's what I mean:

Here is a preg_replace code, the input, and output that should be received, listed below in these text boxes I filled out


Reproduce code:
---------------
$input=htmlentities('<size="100%">This is a code that will change font-size using <span> tags, user-friendly style.</size>');

// This is supposed to do the proper replaces

$output=preg_replace('/&lt;size=&quot;(.+)&quot;&gt;(.+)&lt;\/size&gt;/iU','<span style="font-size: $1;">$1</span>',$input);


Expected result:
----------------
//Now, here is what the script is supposed to output

echo '<span style="font-size: 100%">This is a code that will change font-size using <span> tags, user-friendly style.</span>';

Actual result:
--------------
echo '&lt;size=&quot;100%&quot;&gt;This is a code that will change font-size using <span< tags, user-friendly style.</span>';

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-25 09:39 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Something in your regexp is fishy.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 17:01:28 2025 UTC