From: thochgreve at php-resource dot de
Operating system: any
PHP version: Irrelevant
PHP Bug Type: Feature/Change Request
Bug description: url_rewriter.tags for JavaScript?

I am searching for an easy way to enable transparent SIDs for JavaScript.
url_rewriter.tags seemed to be the thing at first glance; but apparently
there´s no way yet to tell PHP what JS snippets define URLs.

This would be my approach for a solution;
please consider to add this functionality to PHP
and PLEASE let me know your decision.



First, insert '<script language="JavaScript" src="'. $PHP_SELF.
'?='.php_sessionjs_guid(). '"></script>' into the HTML source.
The guid above should define a function addsid(url) (function name
depending on js_rewriter.funcname) which assumes the parameter being a url
and provide the same functionality as the trans_sid feature.

Of course this should only apply if classic trans_sid applies as well.

See the input below for example results.

Sending the string through addsid in any case should work around the
trouble with dynamic values.

You might want to add type recognition to addsid, so that
old: myimage.src="dummy.php";
new: myimage.src = addsid('myimage', 'src', "dummy.php");
with addsid determining the type of myimage

but so far every src or location attribute holds in fact an URL and any
change is improbable, so this would most likely be wasted time.

Reproduce code:

pagename = 'index';
extension = (phpflag ? 'php':'html');
top.frames[1].src = pagename + '.' + extension;
<a href="javascript:top.frames[1].src='index.html';">home</a>
<a href="javascript:;" onClick="top.frames[1].src='index.html';">home</a>
<button onClick="top.frames[1].src='index.html';">home</button>

<form action="submit.php">
<input type="submit" value="submit">
onClick="this.form.action='rollback.php';this.form .submit();">rollback</button>

Expected result:
<script language="JavaScript" src="thisscript.php?=PHP..."></script>


pagename = 'index';
extension = (phpflag ? 'php':'html');
top.frames[1].src = addsid(pagename + '.' + extension);
<a href="javascript:top.frames[1].src=addsid('index.html');">home</a>
<a href="javascript:;"
<button onClick="top.frames[1].src=addsid('index.html');">home</button>

<form action="submit.php">
<input type="submit" value="submit">
onClick="this.form.action=addsid('rollback.php');t his.form.submit();">rollback</button>

Edit bug report at [url][/url]
Try a CVS snapshot (php4): [url][/url]
Try a CVS snapshot (php5): [url][/url]
Fixed in CVS: [url][/url]
Fixed in release: [url][/url]
Need backtrace: [url][/url]
Try newer version: [url][/url]
Not developer issue: [url][/url]
Expected behavior: [url][/url]
Not enough info: [url][/url]
Submitted twice: [url][/url]
register_globals: [url][/url]
PHP 3 support discontinued: [url][/url]
Daylight Savings: [url][/url]
IIS Stability: [url][/url]
Install GNU Sed: [url][/url]