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 broken AND ( + ) filtering #2694
Conversation
Right now, usign a single + for the AND filter did not worked. The + symbol we used is a space character in urls, where most of the filters comes from. So, the idea is to add a new split token, namely "+++" which makes "filter 1 + filter 2" work. This change remove code duplication in the publish page and in the section data source. Fixes symphonycms#2561
I feel like there is an Apache setting at play here. I recall encountering this before but there was some other configuration that needed tweaked. Let me come back to you. |
@brendo Great! I've tested it on WAMP and on my DEV box (Centos 6) and both needed the commit. I've tried magic_quotes on and off. |
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.
I don't like the idea of using +++
in URLs (which translates to 3 spaces, right?). Couldn't we embrace the standards and use an encoded +
character , i.e. %2B
? The rules for URLs are simple in this respect:
- if you want a space, use
+
- if you want a
+
, use%2B
Or do I get something wrong here?
@nitriques, I believe this might of been it? Do you have a test case that I can try locally to see if I can reproduce the behaviour you are experiencing? |
Yes.
Same result :( Adding the And filtering is working on your boxes ? |
@brendo looks like |
You mean it isn't possible to translate a query string to what it means (per the spec)? Differentiating in PHP between |
We would not, and neither should anybody ;) |
From my testing, yes, that's it the case. And from mod_rewrite's doc
|
Why do we have spaces in the URL? I would have thought:
|
Because we want '?foo=value with spaces' to be a search for 'value with spaces' not a search for 'value' AND 'with' AND 'spaces' (remember, we get spaces like '+') |
No, no. Honestly, if we could not differentiate between those query strings, Symphony would do something fundamentally wrong. This is so simple, it MUST be possible. Look at the XML! For <current-query-string>
<![CDATA[ debug=raw&foo=value1,value2 ]]>
</current-query-string>
<url-foo>value1,value2</url-foo> For <current-query-string>
<![CDATA[ debug=raw&foo=value1%2Bvalue2 ]]>
</current-query-string>
<url-foo>value1+value2</url-foo> For <current-query-string>
<![CDATA[ debug=raw&foo=value1+value2 ]]>
</current-query-string>
<url-foo>value1 value2</url-foo> You see that PHP can handle these query strings very well. |
Indeed it does when you do not use '+' for a special treatment... |
What do you need that is not covered by the above examples? (Which can be translated to: Why would you need special treatment? And why does a single + not work?) |
Because Apache converts all spaces and plus sign into the same char.
Because you loose the ability to search for a value that contains the plus sign, which is currently working. Your |
I admit that I didn't have the actual implementation in mind, I have not even looked at it. I just wanted to say that it is technically possible to differentiate between the two characters (which are pretty standard in URLs), and therefore it would hurt to see any custom strings (supposed to have the same meaning as a single character). If Symphony's regex filter implementation makes it hard to work with URL standards, we should really improve the implementation.
Honestly, this sounds like a major design flaw. URLs should always be decoded first. |
I totally agree with what you say, except:
Changing this would require a lot of effort. But my patch just fixes a bug. The When this system will get its overhaul, this should not be a problem, but right now, it's the only way to fix it I can came up with. |
Now I understand. :-( |
I will be happy to fix this later on... Count on me ;) |
You bet! |
Right now, using a single + for the AND filter did not worked. The + symbol we used is a space character in urls, where most of the filters comes from. So, the idea is to add a new split token, namely "+++" which makes "filter 1 + filter 2" work. This change remove code duplication in the publish page and in the section data source. Fixes #2561 Picked from 7ccc080 Picked from 759050a
Right now, using a single + for the AND filter did not worked. The + symbol we used is a space character in urls, where most of the filters comes from. So, the idea is to add a new split token, namely "+++" which makes "filter 1 + filter 2" work. This change remove code duplication in the publish page and in the section data source. Fixes #2561 Picked from 7ccc080 Picked from 759050a
Right now, usign a single + for the AND filter did not worked.
The + symbol we used is a space character in urls, where most of the
filters comes from.
So, the idea is to add a new split token, namely "+++" which makes
"filter 1 + filter 2" work.
This change remove code duplication in the publish page and in the section data source.
Fixes #2561