0 users online. Create an account or sign in to join them.Users

Search

In a similar vein to that discussed on page 3 of this thread I seem to be experiencing double URL encodings for my square brackets.

I have a form on the front-end which submits search parameters (via a GET request). My form contains the following checkboxes for example:

<input type="checkbox" name="market[]" value="local" checked="checked">Local</input>
<input type="checkbox" name="market[]" value="open">Open</input>

I'm using the array style syntax to allow for multiple values.

Upon submission of the front-end form the URL in the browser location bar is:

http://domain.com/?market%255B%255D=local

Notice the %255B% instead of %5B as it should be. The same with the closing square bracket.

This is interfering with my returned URL params in the XML of the page as they are included as:

<url-market-5b-5d>local</url-market-5b-5d>

I'm testing in the latest version of Chrome on OS X but have also tested with Safari and Firefox. All with the same result. I'm running Symphony 2.3.3 (current latest).

Has anyone else come across this problem?

Basically I need to allow for multiple selections of various options in the form so they appear as:

?value=1,2,3,4

In the URL. This is why I'm using the array style syntax in the form element names. But I need to avoid this strange URL encoding issue.

As an update it looks like this thread mentions that double URL encoding was the result of the mod_rewrite rule where the URL was getting encoded twice.

I'm just using the default .htaccess file that comes with Symphony 2.3.3 (master branch). I'm not that fluent with rewrite rules but there looks to be a lot going on in there. Can anyone confirm if they have similar issues. If not, what is in your .htaccess file?

This is my .htaccess file.

Also, if anyone can think of anything else which may be the cause then I'm open to suggestions.

You are experiencing exactly the same problem as this: http://www.getsymphony.com/discuss/thread/51963/3/

I am also using Symphony 2.3.3, and I have no problem doing the exact same thing. I'm using code like this <input type="checkbox" name="feature[]" value="{.}"/> and it comes out like ?feature%5B%5D=Furnished

Thanks for the confirmation Pat. I've managed to resolve this issue now and it was a problem on the server-side rewrites. For some reason some of the rewrite rules had been duplicated so it was just running it twice and therefore being interpreted as literal characters in the URL and in Symphony.

My URL is now encoded as:

http://domain.com/?market%5B%5D=local

as it should be, and the URL params in the parameter pool on the page are:

<url-market.1>local</url-market.1>

That's semi correct but the number appendage is another issue for another thread.

The number appending is because you are using array syntax in the url. It's not an issue.

If you had

http://domain.com/?market=local

you would get

<url-market>local</url-market>

Whereas if you had

http://domain.com/?market%5B%5D=local&market%5B%5D=regional

you would get

<url-market.1>local</url-market.1>
<url-market.2>regional</url-market.2>

For a single value that would be expected behaviour but for front-end form controls which allow for multiple selections the values should be part of an array and un-keyed:

http://domain.com/?market%5B%5D=local,regional

Producing a URL parameter such as:

<url-market>local, regional</url-market>

Rather than:

http://domain.com/?market%5B%5D=local&market%5B%5D=regional

With URL params:

<url-market.1>local</url-market.1>
<url-market.2>regional</url-market.2>

I've raised the issue on Github to explain further.

As we've continued this discussion there, I will close this later if that's ok?

Yep, no point in duplicating discussion. This issue is solved.

:)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details