From: ndermine at adequasys dot com
Operating system: windows, mac os x, debian
PHP version: 5.5.16
Package: Output Control
Bug Type: Bug
Bug description:the URL rewrite mechanism handles <a href=\"javascript in a
surprising manner
Description:
------------
I use output_add_rewrite_var to add a URL parameter to relative links in
my app.
When I have a link like this <a href="javascript:..."> it is left
untouched which is great.
But I had a piece of javascript containing an anchor tag inside a
javascript string :
"<a href=\"javascript..." (note the escaped double quote that is
expected to remain escaped in the HTML page source)
That part was modified in a way that broke the javascript : the new
param was introduced between the backslash and the double quote :
"<a href=\?key=value"javascript..."
I can of course write (and have rewritten) my javascript differently,
but would it be possible to not insert the parameters in this case?
This seems very similar to Bug #19358 "URL Rewriter Blindly Replaces All
Links" (closed because of lack of feedback) which was submitted in
2002.
Thank you for your work.
Test script:
---------------
<?php
output_add_rewrite_var('a', 'b');
?>
<script type="text/javascript">
var link = "<a href=\"javascript:doSomething('with a
parameter')\">link</a>";
</script>
Expected result:
----------------
<script type="text/javascript">
var link = "<a href=\"javascript:doSomething('with a
parameter')\">link</a>";
</script>
Actual result:
--------------
<script type="text/javascript">
var link = "<a href=\?a=b"javascript:doSomething('with a
parameter')\">link</a>";
</script>
--
Edit bug report at https://bugs.php.net/bug.php?id=67887&edit=1
--