Created on 7 August 2019, over 5 years ago
Updated 31 July 2023, over 1 year ago

When using cron i get this warning
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? advuser.module:567
I run 7.x-3.0-beta1+4-dev

Its not important, still annoying.

Solution is to change row 567
from

if (user_access($value, $account)) {
continue; <= this is row 567
}

to
if (user_access($value, $account)) {
continue 2;
}

πŸ› Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden arne_hortell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States kruser

    #8 fixed for us. In our case this module was causing tokens not to render. On the our status page, we had errors like:

    Tokens or token types missing name property
    $info['types']['date']
    $info['tokens']['node']['url']
    $info['tokens']['file']['size']
    $info['tokens']['user']['url']
    $info['tokens']['date']['custom']
    $info['tokens']['metatag']
    

    The patch fixed it.

  • πŸ‡©πŸ‡ͺGermany donquixote

    @colinstillwell, in the current context break and continue have the same effect, exiting the switch. However, as you can see from the diff and code, there is a break that will be called on the subseqent line (if the if isn't executed. As a result it appears that the continue was intended to target the foreach instead of the switch, and changing to continue 2 is the correct fix. If this is breaking your install, then you should consider what this is actually doing, which is checking if the user has access to filter by a given permission, and if not that filter should be skipped all together, using the continue 2 to skip to the next iteration of the foreach. Does that make sense?

    Yes, from the code one should think the intended behavior was continue 2;.
    But this only tells us that this was the intended behavior at the moment the developer wrote this, not that it is currently the intended behavior. Perhaps the intended or expected behavior is for this to just not work at all.

    To me the entire piece looks weird.
    we are creating a user with uid = 'advuser_filter' and a roles array, and no other properties. We then pass this to user_access(), where the non-integer uid or missing properties might trip up access handlers.
    I think the idea is to check this for "any user who is logged in".

    I think we need to better explain the expected behavior before we fix this.

Production build 0.71.5 2024