Label ‘%s’ already defined

Description

A goto label has been defined twice or more. This is not allowed, as the goto call won’t be able to decide which label to reach.

Note that a single unused label is allowed, and is considered dead code.

Multiple identical labels are possible, in different method contexts.

Example

<?php

function foo() {
     C:
     C:

     // valid code, though dead and unused
     D:
}

function bar() {
     // valid code, though dead and unused
     D:
}

?>

Literal Examples

  • Label ‘C’ already defined

Solutions

  • Remove duplicate label.

  • Rename duplicate label.

  • Move the duplicate label to a distinct method.