Project

General

Profile

Actions

Bug #16036

closed

addQueryString does NOT work properly

Added by Dmitry Pikhno over 18 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Communication
Target version:
-
Start date:
2006-04-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

1) it is again does not work with realurl due to the problem that was already fixed BEFORE. (#15286)
shortly speaking: reaurl transforms _GET but does not transform QUERY_STRING
2)problems even without realurl -
"Warning: rawurlencode() expects parameter 1 to be string, array given in /typo3_src/typo3/sysext/cms/tslib/class.tslib_content.php on line 5552"

marks.PRINTLINK {
    file=fileadmin/images/icon_print.gif
    stdWrap.typolink.parameter.data = page:uid
    stdWrap.typolink.additionalParams = &type=98
    stdWrap.typolink.addQueryString = 1
    stdWrap.typolink.addQueryString.method = GET
    #stdWrap.typolink.addQueryString.exclude = cHash
    altText = print version
}

3)and bonus - double "id" in result url (with enabled ".exclude = .." - it is ok)

bugs are in function getQueryArguments in tslib/class.tslib_content.php

this is code of updated function and it works properly(seems works good):

function getQueryArguments($conf,$overruleQueryArgs=array(),$forceArgs=FALSE) {
        $rawValues = FALSE;

        $q_in = array();
        switch((string)$conf['method'])    {
            case 'POST':
                $q_in = t3lib_div::_POST();
            break;
            case 'GET':
            default:
                foreach (explode('&',t3lib_div::implodeArrayForUrl('', t3lib_div::_GET())) as $arg)    {
                    list($k,$v) = explode('=',$arg);
                    if($v)    $q_in[$k] = $v;
                }
            break;
        }

        $q_out = array();
        $exclude = t3lib_div::trimExplode(',', $conf['exclude']);
        $exclude[] = 'id';    // never repeat id
        foreach ($q_in as $k => $v)   {
            if (!in_array($k, $exclude)) {
                if (isset($overruleQueryArgs[$k]))    {
                    $v = $overruleQueryArgs[$k];
                    unset($overruleQueryArgs[$k]);
                }
                $q_out[$k] = $v;
            }
        }
        // any remaining overrule arguments?
        if ($forceArgs)    {
            foreach ($overruleQueryArgs as $k => $v)    {
                $q_out[$k] = $v;
            }
        }
        $content = '';
        foreach ($q_out as $k => $v)    {
            $content .= '&'.$k.'='.($rawValues ? $v : rawurlencode($v));
        }
        return $content;
    }

(issue imported from #M3241)


Files

patch (561 Bytes) patch Administrator Admin, 2006-04-12 10:26
Actions #2

Updated by Michael Stucki over 18 years ago

Hi Martin, I think you were working on that one. Can you please have a look at it?

(Still wondering if reminders are visible to the public - otherwise würde ich natürlich auf deutsch schreiben :-))

Actions #3

Updated by Martin Kutschker over 18 years ago

1) You have to use method=GET with Real URL (won't change this)

2) You're right. Unfortunately the fix for this has been lost.

The end of the function should be like this:
if ($rawValues) {
foreach ($q_out as $k => $v) {
$content .= '&'.$k.'='.$v;
}
} else {
$content = t3lib_div::implodeArrayForUrl('',$q_out);
}

This is now in CVS. Does it work for you?

Actions #4

Updated by Dmitry Pikhno over 18 years ago

yep. it works for me.
thnx

please take a look also on this bug #16116

Actions

Also available in: Atom PDF