jump into a finally block is disallowed

Description

It is not possible to make a goto, when the label is in a finally block. It is OK to do the goto call when both goto and label are in the finally block, though.

Example

<?php

goto theLabel;

try {}
catch (Exception) {}
finally {
     theLabel:
             $a++;
}

?>

Solutions

  • Replace the goto call with something else.

  • Move the goto in the finally block.

  • Move the label out of the finally block.