New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect sort order when scheduled report uses custom report #13487
Conversation
…ePostProcessor gets the Report instance.
$saveQUERY_STRING = @$_SERVER['QUERY_STRING']; | ||
foreach ($parametersRequest as $param => $value) { | ||
$_GET[$param] = $value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it also need to set $_POST or unset it temporarily etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, this code was moved from API\Proxy.php, I didn't change it. We can make it override $_POST
too, just didn't want to accidentally break something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry... only just noticing... I wonder if it breaks functionality if we also did $_GET = array();$_POST=array()
before the foreach? but I think it actually could break functionality. not needed for now I guess as it probably has always been that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually pretty sure it would break behaviour... this is why we currently use $default = []
and needs to be changed there I suppose.
@@ -261,7 +262,12 @@ public function process() | |||
// call the method | |||
$returnedValue = Proxy::getInstance()->call($apiClassName, $method, $this->request); | |||
|
|||
$toReturn = $response->getResponse($returnedValue, $module, $method); | |||
// get the response with the request query parameters loaded, since DataTablePost processor will use the Report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diosmosis does it make sense to move $returnedValue = Proxy::getInstance()->call($apiClassName, $method, $this->request);
into this Context::executeWithQueryParameters
below and remove it from the call
method? The call method isn't API so we can change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some code does call Proxy::getInstance()->call()
directly, eg, DataTableManipulator
s so I think it could break things.
@tsteur Updated to save $_POST parameters as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some ui tests are failing in https://builds-artifacts.matomo.org/matomo-org/matomo/3.x-dev/30298/ but doesn't look to be related to this change 👍
…tomo-org#13487) * Make sure request parameters are loaded in superglobals when DataTablePostProcessor gets the Report instance. * Save POST parameters in Context::executeWithQueryParameters().
Make sure request parameters are loaded in superglobals when DataTablePostProcessor gets the Report instance.
DataTablePostProcessor will call
ReportsProvider::factory()
, but it will call it outside ofPiwik\Api\Proxy
, which means the request parameters won't be in$_GET/$_POST
. So if the Report instance tries to access these in order to configure itself, it may not be able to find them.