Project

General

Profile

Actions

Bug #19182

closed

Wrong getData behaviour in "foo|bar" case

Added by Petro Boychuk over 16 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2008-08-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

What about problem?
We have "foo" data in both(!) GET and POST arrays. But "foo[bar]" data we have only in GET array. We want to get "foo[bar]" element. We can't do that.

Why?
Responsible for that function (now t3lib_div::_GP) looks for "foo" key first in POST array and if founded immediatly returns it. So if we have "foo[bar]" in GET, we have void result.

File: class.tslib_content.php
Line: 4848

Advise for quick solution: replace t3lib_div::_GP with t3lib_div::GParrayMerged

(issue imported from #M9100)


Files

bug0009100.diff (1.09 KB) bug0009100.diff Administrator Admin, 2008-08-15 12:53
bug0009100_correct.diff (1.12 KB) bug0009100_correct.diff Administrator Admin, 2008-08-15 13:24
bug0009100_correct_updated.diff (1.05 KB) bug0009100_correct_updated.diff Administrator Admin, 2008-08-15 14:00
bug0009100_final.diff (664 Bytes) bug0009100_final.diff Administrator Admin, 2008-08-15 14:36
Actions #1

Updated by Benni Mack over 16 years ago

hey

wouldn't it make more sense to have a GPvar and additionally GETvar and POSTvar for that?

Actions #2

Updated by Petro Boychuk over 16 years ago

As far as I know there are separate methods to get GET and POST vars in t3lib_div.
Bu the problem is that if there are same first level names in both $_GET and $_POST superglobal arrays than data from $_POST array will be returned.
Example:
$_GET = array(
'foo' => array(
'bar' => '1'
)
)

$_POST = array(
'foo' => array(
'bar2' => '2'
)
)

So result of t3lib_div::GPvar('foo'); will be
array (
'bar' => '1'
)

But expected value (as far as I understand it) must be

array(
'bar' => '1',
'bar2' => '2'
)

I use (and it seems that core too) this function to get data when it is not known how data arrives, from GET or POST, or maybe both.

Actions #3

Updated by Benni Mack over 16 years ago

Hey Petro,

can you create a patch for this and send it to the core list?

Thanks

Actions #4

Updated by Myroslav Holyak over 16 years ago

Changes in _GP function caused wrong work of typo3 backend and oteher extensinos (sr_fe_register at least). So only way to patch i see is to replace call _GP function by GParrayMerged in class.tslib_content.php

There is one problem: function GParrayMerged is deprecated. Interesting to know why. It has the same "stripslash" sanitizing as _GP.

Please, remove my old patches

Actions #5

Updated by Benni Mack over 16 years ago

Hey,

I see, GParrayMerged is deprecated. So for me the one and only solution would be to have not just TSFE and GP and such, but also GET and POST as options

[globalVar = GET:foo|bar = mymatch]

[globalVar = POST:foo|bar = mymatch]

Anyway, all the changes need to happen in t3lib/class.t3lib_matchcondition.php, as there is the change we need, not in all _GP occurrences.

Actions #6

Updated by Dmitry Dulepov about 16 years ago

No change to t3lib_div::_GP() because it impacts compatibility.

Use global:_REQUEST if you really have too. Or better change your code to have that parameter only in one place.

I recommend closing this bug with "won't fix". We should not make workarounds to support bad architecture issues (same var in both GET and POST).

Actions #7

Updated by Myroslav Holyak about 16 years ago

Why "same var"? GET[foo][bar] and POST[foo][bar1] isn't the same var. It can be if extension submit form and at the same time had some parameters in address bar. Of course we can transfer all by POST and have "all variables in the same place" in that way. On my opinion it must be developer decision and API should give secure possibility to do that.

Actions #8

Updated by Benni Mack over 14 years ago

these methods have changed to all use "array-merged-recursive-overrule". Does this bug still exists for you?

Actions #9

Updated by Myroslav Holyak over 14 years ago

No, it's gone away . Thank you, nice choice of solution.

Actions

Also available in: Atom PDF