phpvideotoolkit-v2 icon indicating copy to clipboard operation
phpvideotoolkit-v2 copied to clipboard

Mime.php has misleading code

Open jesseforrest opened this issue 4 years ago • 0 comments

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;

jesseforrest avatar Oct 15 '21 03:10 jesseforrest