Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently, the API pages for hook_filter
and filter_example_filter
still use the pre-SA \xFE/\XFF escaping, which has been disabled since SA-2008-06 (http://drupal.org/node/208564), for Drupal 4.7.x, 5.x, 6.x and 7.x
See
- http://drupal.org/node/208636 for a discussion that seems to have stabilized replacement choices
- http://drupal.org/node/209715 for our current documented practices regarding placeholders.
Comments
Comment #1
brunodboChanged the component to reflect the new component categorization. See http://drupal.org/node/301443.
Comment #2
deviantintegral CreditAttribution: deviantintegral commentedSubscribing - I just spent quite some time trying to figure out why the escaping wasn't working anymore.
Is the procedure for updating docs in CVS just like with core - do HEAD, then backport as needed?
Comment #3
deviantintegral CreditAttribution: deviantintegral commentedHere is a patch against HEAD which addresses this issue. It changes the following:
time()
. The module wouldn't have worked unless register globals was enabled.The only other suggestion I could make is that there is no mention of the .info file which exists in CVS. For those new to Drupal, not having a link to that would be very confusing for those attempting to run the code. I'm guessing this is more of an api.d.o infrastructure task though.
Comment #4
deviantintegral CreditAttribution: deviantintegral commenteddrewish just pointed out to me that REQUEST_TIME is actually a new D7 feature - should have noticed that the D6 module page uses time().
Here's an updated patch - when it's ready for backporting, remember to replace REQUEST_TIME with time() for D4.7-6.
Comment #5
Dries CreditAttribution: Dries commentedIs there any reason we mix underscores and dashes in
[filter_example-time]
? Let's make this consistent and set the right example in ... example code. :-)Comment #6
deviantintegral CreditAttribution: deviantintegral commentedI was following the convention as documented at http://drupal.org/node/209715, which seems to indicate that dashes should be used between the namespace and the filter. I can update both the patch and the page to indicate that underscores are preferred, but that dashes are allowed.
Also, I just noticed that the handbook page example uses [modulename-tag] for the opening tag and [/tag-modulename] for the closing tag. Anyone know if there is a reason why the order is reversed in the close tag?
Comment #7
Dries CreditAttribution: Dries commentedCan't you update the patch to just use dashes?
Comment #8
deviantintegral CreditAttribution: deviantintegral commentedSure, as long as we're OK with the module name not matching exactly. Patch is the same as above, with the tag set to [filter-example-time].
Comment #10
deviantintegral CreditAttribution: deviantintegral commentedI believe the last test failed because it tried to apply it to core. The patch still applies cleanly to the documentation project.
Comment #11
Dries CreditAttribution: Dries commentedCan you provide a patch for CVS HEAD too?
Comment #12
deviantintegral CreditAttribution: deviantintegral commentedThe patch in #8 is against /cvs/drupal-contrib/contributions/docs/developer/examples/filter_example.module HEAD, unless you mean HEAD on some other path?
Comment #13
Dries CreditAttribution: Dries commentedThe documentation now lives in core, and no longer in contrib. I was referring to core HEAD. :)
Comment #14
deviantintegral CreditAttribution: deviantintegral commentedHere is a patch implementing the same change against the hook documentation. The above patch is still needed for filter_example.module though.
Comment #15
cburschkaBoth patches look good. Testbot didn't like the first one because it cannot account for the drupal-contrib repository, but the patch applies just fine.
However, a caveat: The forbidden high-bit characters were used for a reason. What happens if I write [codefilter-code] into my comment manually? Can we afford not to check for conflicts in input?
Comment #16
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!
Comment #18
fgmNeeds to be ported to the 6.x docs, which are still wrong.
Comment #19
deviantintegral CreditAttribution: deviantintegral commentedHere's a patch against DRUPAL-6--1-1 based off of the patch from #2. Will this also need to be ported to D5?
Comment #20
sillygwailoI just noticed that the handbook page example uses [modulename-tag] for the opening tag and [/tag-modulename] for the closing tag.
I made the change just now. Not claiming that the docs at http://drupal.org/node/209715 are now 100% correct, but if you see something that should be changed in documentation, just make the change and we can revert back if necessary.
Comment #21
deviantintegral CreditAttribution: deviantintegral commented#19 still applies cleanly; it would be great if someone else could review and consider marking as RTBC.
Comment #22
jhodgdonThat last patch is against the filter.example module. Example modules have been moved into a different repository, so if you want to get something changed in that example, please file a new issue against the "Examples for Developers" module. I'm not going to move this issue over to that queue, because that would sort of negate the history of it being a fixed D7 core issue.
The patch that was applied in D7 from #14 changed the filter hook doc though. Do we need to do the same for D6, or did someone already do so?
Comment #23
deviantintegral CreditAttribution: deviantintegral commentedI've opened an issue over in the examples contrib module over at #709376: Don't use invalid UTF characters for the example time filter. This should probably be fixed in the D5 documentation as well.
Comment #24
deviantintegral CreditAttribution: deviantintegral commentedAnd here is a patch against DRUPAL-5.
Comment #25
jhodgdonUm. Was there a patch/commit for Drupal 6 to fix the hook doc, like what was done in #14 for Drupal 7?
Comment #26
jhodgdonIt looks like http://api.drupal.org/api/function/hook_filter/6 for Drupal 6 has not been updated yet. So I'm setting this back to Drupal 6.
It also looks like the filter example for Drupal 6 has not been updated either -- http://api.drupal.org/api/function/filter_example_filter/6 ? Although the issue on the Examples project is marked as fixed for Drupal 6.
But I could be wrong... Can someone verify?
Comment #27
jhodgdonActually, it looks like the filter example module was updated, but api.drupal.org has not caught up with it.
But the hook doc for D6 has not been updated. That is in the contrib repository in the developer docs section.
Comment #28
fgmExample is still wrong (on hook page).
Comment #29
jhodgdonAgreed.
http://api.drupal.org/api/function/hook_filter/6 is wrong.
http://api.drupal.org/api/function/filter_example_filter/6 has been fixed.
Comment #30
jhodgdonComment #31
jhodgdonI have just updated the hook_filter() example in the D6 docs contrib repository, using the patch from #14 that was accepted for D7 as a model.
We aren't maintaining the examples for developers in Drupal 5 any more. We could port this fix to Drupal 5, but I don't think it's a very high priority. If someone wants to, use the patch in #14 as an example, and the code is in the contrib repository.
Comment #32
jhodgdon7.0 is out tomorrow, 5.x is obsolete, won't fix, sorry.