Skip to content
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

request.getVar not populated with GET parameters | unexpected behavior #4418

Closed
reedjones opened this issue Mar 12, 2021 · 4 comments
Closed
Labels
waiting for info Issues or pull requests that need further clarification from the author

Comments

@reedjones
Copy link

According to the docs:

"The getVar() method will pull from $_REQUEST, so will return any data from $_GET, $POST, or $_COOKIE."

This unexpectedly changes, sometimes it has the data sometimes it doesn't, seemingly for no reason...

CodeIgniter 4 version

v4.0.4

Affected module(s)
Incoming Request Class

Expected behavior, and steps to reproduce if appropriate

In a controller:
(the url contains GET parameter example.com?value=1)

request.getVar() should contain: value,1

public function index(){
       $whatever = $this->request->getVar("value");
       // $whatever should equal 1 but it is null   (sometimes)

      $thisworks = $this->request->getGet();
      $whatever = $thisworks['value']; 
     // $whatever is equal to 1   (this always works) 
}

Context
tested on windows 10 and ubuntu

@reedjones reedjones added the bug Verified issues on the current code behavior or pull requests that will fix them label Mar 12, 2021
@paulbalandan
Copy link
Member

It is hard to confirm this issue if it occurs "sometimes". You need to give us at least a reproducible test script that will imitate this occasional behavior. Otherwise, this cannot be considered as a real bug.

@paulbalandan paulbalandan added waiting for info Issues or pull requests that need further clarification from the author and removed bug Verified issues on the current code behavior or pull requests that will fix them labels Mar 12, 2021
@luispastendev
Copy link

I did a quick test on the problem but everything seems to work fine, here is a related issue. #4381

@reedjones
Copy link
Author

I did a quick test on the problem but everything seems to work fine, here is a related issue
It is hard to confirm this issue if it occurs "sometimes".

yeah that's the strange thing, in my project I have calls to getVar() all over the place, sometimes it fails, sometimes it doesn't, I had to basically go around the whole project and replace getVar with getGet..

I've noticed:
it seems to work if the var is in POST, doesn't work if the var is in GET
I can't seem to reproduce it on my local environment (windows ), only seems to happen on my server (linux)

I'll try to see if I can reproduce it locally and get more info

@paulbalandan
Copy link
Member

I believed this has been fixed by #4493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for info Issues or pull requests that need further clarification from the author
Projects
None yet
Development

No branches or pull requests

3 participants