php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31647 output_add_rewrite_var("var","a") called multiple times adds multiple var=a
Submitted: 2005-01-21 21:54 UTC Modified: 2005-02-15 00:54 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: jeff at wecreate dot com Assigned:
Status: Wont fix Package: Output Control
PHP Version: 4CVS, 5CVS (2005-02-10) OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-01-21 21:54 UTC] jeff at wecreate dot com
Description:
------------
multiple calls to output_add_rewrite_var() with identical vars creates multiple entries on the link.

Reproduce code:
---------------
output_add_rewrite_var("var","a");

output_add_rewrite_var("var","b");


echo '<a href="test.php">test</a>';


Expected result:
----------------
<a href="test.php?var=b">test</a>

Actual result:
--------------
<a href="test.php?var=a&var=b">test</a>

this is useless as var can only have one value.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-24 04:43 UTC] sniper@php.net
So what exactly should happen (in your opinion) when you call this function twice for same variable?

I don't think we'll "fix" this since there isn't really anything to fix here. IMO.

 [2005-02-10 02:22 UTC] jeff at wecreate dot com
I would assume that in the case where the variables are 
identical, the second call would 'overwrite' the value 
of the first call.

for example:

<?
$foo = "bar";
$foo = "bar2";

echo $foo;
?>
would result in "bar2".

so I would assume 
<?
output_add_rewrite_var("var","a");
output_add_rewrite_var("var","b");
echo '<a href="test.php">test</a>';
?>
would result in: "<a href="test.php?var=b">test</a>".

More to the point, If I call 
output_add_rewrite_var("var","a") twice in the same 
script, it doesn't make sense that it would add ?
var=a&var=a , it should only add var=a once.

Thanks.
 [2005-02-15 00:54 UTC] iliaa@php.net
I would make the same assuption about the operation of the code, however I'd imagine that since this functionality has been around for a while some people actually rely on it. Changing it now would break BC and cause all sorts of problems.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 19:01:23 2020 UTC