User tests: Successful: Unsuccessful:
Create 3 articles (Test article 1, Test article 2, Test article 3)
Create 3 Tags in the Tags Component (Tag 1, Tag 2, Tag 3)
Add to all the three articles all three tags
Create a menu item of the type "Compact list of tagged items"
Select in the menu item all the three tags in the Tag field
Select content type Article.
Access the menu item and the warning "Notice: Array to string conversion in C:\xampp\htdocs\joomla\libraries\joomla\filter\input.php on line 201" should be there.
There should be no Notice warning
A warning "Notice: Array to string conversion in C:\xampp\htdocs\joomla\libraries\joomla\filter\input.php on line 201"
The list of the articles which have the corresponding tags
PHP versie 5.6.9
Webserver Apache
WebServer naar PHP interface litespeed
Joomla! versie Joomla! 3.4.3 Stable [ Ember ] 2-July-2015 16:00 GMT
Joomla! Platform versie Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
Gebruikersagent Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36
Please check the code an I hope it does not break anything...
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
I gave it a shot, turns out to be a bit more complicated. You can check out my attempt https://github.com/photodude/filter/blob/patch-2/src/InputFilter.php
With the additional checks and function calls, I ended up with a single data scenario that fails. (an array with arrays for data)
https://travis-ci.org/joomla-framework/filter/jobs/70484294
Category | ⇒ | Libraries |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-08-17 23:01:30 |
Closed_By | ⇒ | RickR2H |
Check com_tags, the error is most likely there and not in the filter class.
The thing is that com_tags is very strange in that the id parameter can either contain an integer (what we are used to), an array of integer (probably your case with multiple tags) or even a coma-separated list of ids.
I'm betting the issue is somewhere there
I have tested the steps listed in this issue with Joomla! 3.4.2, 3.4.3, 3.4.4, 3.4.5, and the staging branch
With a bitnami stack
PHP Version 5.4.39
Database Version 5.5.42
I was unable to replicate this issue. Either it was a fluke or we are missing something in the steps that caused the issue.
@RickR2H
Just my opinion, but reading over your PR I don't think your addressing the issue correctly. You have attempted to deal with the array to string conversion in one CASE; but reading the "clean" method docblock, all of the $type cases are affected any time the $source variable is an array (as "intended" by the docblock var definition for the $source)
Since $source is intended to be a string or an array of strings, any fix should address all $type cases rather than just the singular case in your PR. I'm not sure what the best why to deal with that is, but it looks like maybe creating a new variable that is only the first string of the $source variable to run through the $type switch case.
Maybe something like this pseudo-code before the switch case
Then change all the references in the cases that need a string value for
preg_match()
to use the new variable rather than $source. The exception is to not change the default case since it correctly deals with $source as is.Another way to address this would be to consider changing
preg_match()
forpreg_grep()
sincepreg_grep()
accepts an input array. Or to specify that we only want the first value from $source when at eachpreg_match()
case. but as I said, I'm not sure what the best why to deal with this issue is.PS I think this might be a framework issue rather than a CMS issue. I would suggest a PR in the framework for the input filter clean function https://github.com/joomla-framework/filter
Then the change can be back ported from the framework to the CMS
It looks like there is a fair amount of work needed on the clean function.