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

Invalid superglobal - request.getPost inside volt file #13252

Closed
hufersil opened this Issue Jan 13, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@hufersil

hufersil commented Jan 13, 2018

Using Phalcon < 3.2 I can use {{ request.getPost('varname') }} (inside volt template) without problems.

Once we upgrade to 3.2.4, we get this exception: "Invalid superglobal".
If called inside a controller ( $this->request->getPost('varname') ), there is no problem.

Expected and Actual Behavior

Expected - get post content of varname index or null if not present inside a volt template.
Actual behavior - throwing exception.

Describe what you are trying to achieve and what goes wrong.

Get post var using request.getPost('varname')

Provide output if related. Provide coredump if any. Use https://github.com/phalcon/cphalcon/wiki/Generating-a-backtrace as reference

inside a volt template:

{{ request.getPost('varname') }}
  • Phalcon version: 3.2.4
  • PHP Version: 7.0.22-0ubuntu0.16.04.1
  • Operating System: Linux ip-172-31-44-144 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64
  • Server: Nginx
@Jurigag

This comment has been minimized.

Member

Jurigag commented Jan 13, 2018

Does $_POST return anything? This error is happening when superglobal doesn't exist like you have enable_post_data_reading set to disabled.

@hufersil

This comment has been minimized.

hufersil commented Jan 13, 2018

@Jurigag

This comment has been minimized.

Member

Jurigag commented Jan 13, 2018

Hmmm it might be about symbol tables. Just pass this value from controller to view as workaround. There was update to zephir which added check if superglobal is valid. I will check it next week if there is indeed any probleem.

@hufersil

This comment has been minimized.

hufersil commented Jan 13, 2018

@hufersil

This comment has been minimized.

hufersil commented Jan 15, 2018

Guys I don't know what happend with this update, but there are others places that was working and now it isn't...

This code is working correctly with phalcon < 3.2:

{{ select(item.name, item.options, 'label': item.label, 'using': [item.optionKey, item.optionLabel], 'simple':true, 'emptyText': item.label) }}

Throws this exception with 3.2:

Invalid superglobal#0 [internal function]: Phalcon\Tag::getValue('coddificuldade', Array)
#1 [internal function]: Phalcon\Tag\Select::selectField(Array, NULL)

@sergeyklay sergeyklay self-assigned this Feb 6, 2018

@mruz

This comment has been minimized.

Contributor

mruz commented Mar 18, 2018

I can confirm the issue, @sergeyklay any update? phalcon/zephir#1623

@sergeyklay

This comment has been minimized.

Member

sergeyklay commented Mar 18, 2018

Let's use phalcon/zephir#1623 to discuss this issue

@sergeyklay

This comment has been minimized.

Member

sergeyklay commented Apr 25, 2018

Fixed in the 3.4.x branch. Feel free to open a new issue if the problem appears again. Thank you for contributing.

@sergeyklay sergeyklay closed this Apr 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment