Closed (fixed)
Project:
Coder
Version:
5.x-2.6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
2 Oct 2007 at 14:18 UTC
Updated:
21 Dec 2007 at 18:11 UTC
Jump to comment: Most recent file
In the following code, I'm being told that the usage is deprecated, which is true, however, the code looks to me like it's been commented out, therefore it shouldn't have been checked.
/* if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
return _weblinks_confirm_delete($edit['tid']);
}*/
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | coder_5x_180235.patch | 4.22 KB | stella |
| #3 | coder_180235.patch | 4.51 KB | stella |
Comments
Comment #1
douggreen commentedThe problem here is specific to the coder #source => 'all', which is used for a few rules. In general, coder strips quotes to their bare basics and just compares for '', however in some cases, the actual value of the quote is needed. That's what is happening here. Coder is looking for $_POST['op']. If coder's default #source => 'php' is used, it would be comparing against $_POST[''] and not match. So what it's doing is matching against the 'all' source. The problem is the 'all' source also includes comments.
What coder needs is another '#source' that includes php and strings, but does not include comments. This source might be called 'allphp' or something like that. It affects about a dozen current rules.
Comment #2
douggreen commentedComment #3
stella commentedThe attached patch implements a "allphp" #source for the 6.x version. I can produce another one for the 5.x version if you wish. I have tested it but probably not rigorously enough, so the more people trying it out the better.
Cheers,
Stella
Comment #4
douggreen commentedStella, did you test this out by modifying the above rule (it's in the POST['op'] rule in the 5.x upgrade), which means that you'll also want to make this patch to the 5.x version also? It's probably a worthwhile feature, but since it's to fix a 5.x upgrade feature, it's up to you...
Comment #5
stella commentedI've attached a patch for the 5.x version as well.
While the rule in this particular case was for upgrading from 4.7.x to 5.x, the "allphp" #source is something that may come in handy elsewhere. I tested it out with the rule mentioned above and it seemed to do the trick. I had one line in comments and another without, only the one outside the comments was alerted on. I tested it with double quotes too.
I'd like to get more people testing this if possible though, and with other rules as well.
Once this patch has been reviewed and checked in, then I'll change the POST['op'] rule to use "allphp" as the source instead. There's probably not many module maintainers upgrading from 4.7.x to 5.x at this point but the rule change itself is very small.
Cheers,
Stella
Comment #6
douggreen commentedI committed this, plus I modified many of the rules to use 'allphp' instead of 'all'.
Comment #7
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.