Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
filter.module
Priority:
Critical
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
24 Mar 2014 at 09:52 UTC
Updated:
29 Jul 2014 at 23:28 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
wim leersComment #2
wim leersForgot to clean up the comment.
Comment #3
sunUnless there is a very good reason for why we cannot,
filters()(FilterBag) should return the sorted filters already.We should prevent anyone from operating on unsorted filters.
weight?
Comment #4
wim leersUghhh… I completely messed up everything just before posting the patch :(
I agree with #1 in principle, but I fear that goes against the semantics of
PluginBags? Why else wouldn't that have been done in the conversion toPluginBags?Comment #7
tim.plunkettHmm, FilterFormat::preSave() sorts the filters, I would have thought that would take care of it.
If you call $format->filters(), it gives you the bag with the filters uninitialized. That way you can check things like ->has('filter_html') quickly.
sort() always initializes all of the plugins.
But if you're about to loop over them anyway, you don't really care...
Comment #8
wim leers#7: so your point is… that we should make
FilterFormat::filters()always sort the filters?Comment #9
tim.plunkettThey can be sorted on init and still sorted again on save, but not on every retrieval.
Comment #10
wim leersThanks! :)
I'm fine with that, but then we need to update
FilterFormatInterface::filters()also.Comment #13
tim.plunkettHah! That test is actually wrong. The order of the value returned by getFilterTypes does not actually matter, but in HEAD it was unsorted, and the test was asserting based on that order. Now that we're sorting them, the type of the filter with weight -10 comes before the -1 filter.
Comment #14
vegi commentedI have the exact same problem with Drupal 7.26.
Is there a fix, too?
The PHP-Evaluator should come before the "GMap Macro expander". The order is correct set in admin/config/content/formats/php_code but it doesn't work.
Comment #15
sunAwesome - that looks much better + secure now, thanks! :-)
Comment #17
webchickvegi: Hm. Doesn't sound related, since this is D8-specific code. Maybe open a separate 7.x issue to discuss?
I needed to add a comment to this prior to commit, because I had no idea what "crazy" means in this context. It doesn't feel overly crazy to me to strip out invalid HTML prior to escaping angle brackets. (I guess you meant it's crazy to say that llamas are not awesome, but then I'd call that variable "$crazy_text" instead.)
Though I'm all for silliness, in this case I think it might be an example of us being a little too silly, to the detriment of the next poor person to read/debug this code. :) Not really a reason to hold up a critical, though.
Anyway, extended the description with this:
And committed/pushed to 8.x. Thanks!