syntax error, unexpected identifier “%s”, expecting “]”

Description

PHP has found two identifiers, one next to the other. This might happen inside an attribute declaration or a function call, where a separator has been forgotten.

Example

<?php

#[A name:a)]  // forgotten opening parenthesis
class X {}

?>

Solutions

  • Close the attribute with a closing square bracket. The following code needs to be updated too.

  • Open the argument part of the attribute, with an opening parenthesis.