No Code Attached Yet Documentation Required bug
avatar Ruud68
Ruud68
17 Jun 2021

Steps to reproduce the issue

create a SEF url with Route::_ like this:

Route::_('index.php?option=com_example&task=payment.response&processor=paylater&order=1234567890&test1=123&test2=456', true, Route::TLS_IGNORE, true)`

the router builds the following URL:

[yourdomain]/nl/sub/payment-page/payment/response?processor=paylater&order=1234567890&test1=123&test2=456

now in the site controller for com_example do a var_dump for: \Jooma\Input\Input

Expected result

The extra query parameters (order, test1, test2) should be part of the data (retrievable with getString)

Actual result

Joomla 3: this works okay as the following data is in Input:

protected 'data' => 
    array (size=12)
      'processor' => string 'paylater' (length=8)
      'amp;order' => string '1234567890' (length=10)
      'amp;test1' => string '123' (length=3)
      'amp;test2' => string '456' (length=3)
      'language' => string 'nl-NL' (length=5)
      'order' => string '1234567890' (length=10)
      'test1' => string '123' (length=3)
      'test2' => string '456' (length=3)
      'Itemid' => string '4490' (length=4)
      'option' => string 'com_example' (length=20)
      'task' => string 'payment.response' (length=16)
      'lang' => string 'nl-NL' (length=5)

On Joomla 4 however this will fail as the data is not fully stored / converted, as you can see below only the (e.g. 'amp;order' is stored and not 'order' so trying to getString('order') will fail

protected 'data' => 
    array (size=4)
      'processor' => string 'paylater' (length=8)
      'amp;order' => string '1234567890' (length=10)
      'amp;test1' => string '123' (length=3)
      'amp;test2' => string '456' (length=3)

System information (as much as possible)

Additional comments

workaround (or better solution) is not to use \Joomla\Input\Input but Factory::getApplcation()->input as this works correct in both Joomla 3 and Joomla 4

avatar Ruud68 Ruud68 - open - 17 Jun 2021
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Jun 2021
avatar Fedik
Fedik - comment - 17 Jun 2021

I not fully understood what exactly you dumping, and how it related to Route::_()
but yes, you should always use $app->input

In Joomla 3 Input::$data is reference to $_REQUEST, so the changes applies in both ways:

if ($source === null)
{
$this->data = &$_REQUEST;
}

in Joomla 4 Input::$data is copy of $_REQUEST:
https://github.com/joomla-framework/input/blob/bba837434b13a0d5cb495bb6eeee3547da306f8e/src/Input.php#L93-L98

avatar Ruud68
Ruud68 - comment - 17 Jun 2021

Thanks for the followup :)
I have search documentation and especially the BC document but couldn't find any reference to this difference in J3 / J4
In order to avoid time loss / 'frustration' / debugging why things are not working as expected this should at least be documented.
That is why I took the time to report, already started to change (and test everything all over again) for my own extensions :)

avatar Ruud68
Ruud68 - comment - 17 Jun 2021

And is in J4 the $_REQUEST by design or should it be &$_REQUEST like it is in J3?

avatar Fedik
Fedik - comment - 17 Jun 2021

I cannot say, I do not know.
I suspect it is by design, but better to ask someone who know :)

avatar HLeithner
HLeithner - comment - 17 Jun 2021

It's expected but need documentation @wilsonge ?

Reference https://groups.google.com/g/joomla-dev-framework/c/ngYzAqZMnSY

avatar Ruud68
Ruud68 - comment - 18 Jun 2021

Thanks @HLeithner for digging this up. Should definitely be documented as it is (imo) a b/c break. My experience is that when it happens to me, it will for sure happen to others to :)

avatar wilsonge
wilsonge - comment - 18 Jun 2021

Yeah I think this is expected. We can definitely add it to the b/c breaks page

avatar wilsonge wilsonge - change - 18 Jun 2021
Labels Added: ?
avatar wilsonge wilsonge - labeled - 18 Jun 2021
avatar chmst chmst - change - 20 Feb 2023
Labels Added: No Code Attached Yet Documentation Required bug
Removed: ? ?
avatar chmst chmst - labeled - 20 Feb 2023
avatar Hackwar
Hackwar - comment - 29 Mar 2024

@wilsonge can you write the documentation or can we close this one?

avatar HLeithner
HLeithner - comment - 29 Mar 2024
avatar Hackwar Hackwar - change - 2 Apr 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-04-02 12:51:23
Closed_By Hackwar
avatar Hackwar Hackwar - close - 2 Apr 2024
avatar Hackwar
Hackwar - comment - 2 Apr 2024

I documented the change on the given page. Closing this issue.

Add a Comment

Login with GitHub to post a comment