Closed demianturner closed 11 years ago
[demian] interesting problem, i never tried to get the original back after it was cleaned, but good point
[demian] Hi codebrewery
Thanks for the patch, I agree with your fix but am concerned the change in behaviour will upset some users, even if they are used to the wrong behaviour. I will implement this in trunk tho.
Using SGL_Request::get multiple times with different values for the second parameter ($clean) can cause unexpected results due to the fact that the "cleaned" version of the parameter is stored for future access. As such, a parameter of "foo=
bar
":{{{ $foo = $req->get('foo'); // the contents of $foo are "bar" }}}
$foo equals "bar" (because tags have been stripped) as expected, but later in the code we want the full parameter with markup, so we use:
{{{ $foo = $req->get('foo', true); // the contents of $foo are still "bar" and not "
bar
" as expected! }}}We expect $foo to be '
bar
' but alas the first call has cleaned the markup and stored it over the original parameter, so we lose the markup. Patch attached.