PHP Classes

"REWRITE_SRC_PATH" BUG

Recommend this page to a friend!

      Fast Template  >  All threads  >  "REWRITE_SRC_PATH" BUG  >  (Un) Subscribe thread alerts  
Subject:"REWRITE_SRC_PATH" BUG
Summary:Bug in RegExp expresion
Messages:2
Author:Vasiliy
Date:2006-08-10 15:32:04
Update:2006-08-10 19:56:49
 

  1. "REWRITE_SRC_PATH" BUG   Reply   Report abuse  
Picture of Vasiliy Vasiliy - 2006-08-10 15:32:04
There is one RexExp expression
$regexPattern[] = "/<\s*link\s+[^>]*href\s*=\s*[\\\"']?([^\\\"' >]+)[\\\"' >]/is";

it is used in "preg_replace_callback" function to call "rewrite_link_href_callback" as a custom callback function. The callback is called and passed an array of matched elements.

Good enough, but if we pass to "preg_replace_callback" <link> tag
(example <link href="styles.css" rel="stylesheet" type="text/css" />)

we will receive
<link href="styles.css" styles.css rel="stylesheet" type="text/css" />

as you can see we have double "styles.css" so <link> tad doesn't work.

To reduce this bug, you need no delete "(" and ")" from this expression, here is the result
/<\s*link\s+[^>]*href\s*=\s*[\\\"']?[^\\\"' >]+[\\\"' >]/is

  2. Re: "REWRITE_SRC_PATH" BUG   Reply   Report abuse  
Picture of Valics Lehel Valics Lehel - 2006-08-10 19:56:49 - In reply to message 1 from Vasiliy
TX, we will review and fix it.