Jump to content

Get URL parameters with Tools::getValue() method


Recommended Posts

Hi,

 

I need to get URL parameter for an XML file, but Tools::getValue() removes backslash from URL ("D:\update_preturi\ral.xml" becomes "D:update_preturiral.xml"). The solution is to use $_POST or $_GET, but if i use them I don't pass the prestashop validation. What is the solution?

 

Thank you!

Edited by ovy79ro (see edit history)
Link to comment
Share on other sites

  • 4 years later...

Actually Tools::getValue() isn't meant for any type of data in particular.

The docstring reads:

// Get a value from $_POST / $_GET
// if unavailable, take a default value

getValue() is being overly cautious, essential breaking perfectly valid (and properly encoded) url parameters and modifies them.

If you need slashes in your URL parameters just use:

$myVariable = ( isset($_GET['myVar']) ? $_GET['myVar'] : false);

It's a bit more work, but it solves your problem.

Edited by Appwards (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...