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']);
  }*/
CommentFileSizeAuthor
#5 coder_5x_180235.patch4.22 KBstella
#3 coder_180235.patch4.51 KBstella

Comments

douggreen’s picture

Assigned: Unassigned » douggreen
Priority: Minor » Normal

The 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.

douggreen’s picture

Title: Comments being reviewed » New #source for allphp
stella’s picture

Status: Active » Needs review
StatusFileSize
new4.51 KB

The 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

douggreen’s picture

Stella, 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...

stella’s picture

StatusFileSize
new4.22 KB

I'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

douggreen’s picture

Status: Needs review » Fixed

I committed this, plus I modified many of the rules to use 'allphp' instead of 'all'.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.