Skip to content

Mime.php has misleading code #125

Description

@jesseforrest

We use phpvideotoolkit in production and log warnings to ensure our code doesn't have any issues. We are receiving the following warning:

Got error 'PHP message: PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /vendor/buggedcom/phpvideotoolkit/src/PHPVideoToolkit/Mime.php on line 189'

Looking into it, the warning is valid and the code has the following confusing logic:

default:
   // date, ldate, ledate, leldate, beldate, lebelbe...
   continue;

Depending on the intended behavior that code should be changed to either:

A) If you want to keep the current behavior

default:
   // date, ldate, ledate, leldate, beldate, lebelbe...
   break;

B) If the logic is supposed to intentionally skip to the next foreach iteration and not add anything to $mime_magic_data[] then it should be the following

default:
   // date, ldate, ledate, leldate, beldate, lebelbe...
   continue 2;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions