ParseError: syntax error, unexpected ')', expecting ']' in Composer\Autoload\includeFile() (line 59 of /srv/bindings/3cca46d015ae47d6b58244cc3eb7e992/code/docroot/modules/contrib/schema_metatag/src/Plugin/metatag/Tag/SchemaSpeakableTrait.php) #0

https://git.drupalcode.org/project/schema_metatag/blob/8.x-1.x/src/Plugi...

Currently:

    $form['xpath'] = [
      '#type' => 'textfield',
      '#title' => $this->t('xpath'),
      '#default_value' => !empty($value['xpath']) ? $value['xpath'] : '',
      '#description' => $this->t('ex: @example',
        ['@example' => "'/html/head/title'", "'/html/head/meta[@name=\'description\']/@content']'"),
    ];

Needs to be:

    $form['xpath'] = [
      '#type' => 'textfield',
      '#title' => $this->t('xpath'),
      '#default_value' => !empty($value['xpath']) ? $value['xpath'] : '',
      '#description' => $this->t('ex: @example',
        ['@example' => "'/html/head/title'", "'/html/head/meta[@name=\'description\']/@content']'"]
      ),
    ];
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidburns created an issue. See original summary.

davidburns’s picture

davidburns’s picture

Still a couple other syntax errors. No fatal, but really slows down page load times if not fixed.

jhedstrom’s picture

Status: Active » Reviewed & tested by the community

This indeed resolves the fatal error.

apaderno’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.19 KB

(This is the patch written by mpdonadio in #3078595: Fix typo / syntax error in SchemaSpeakableTrait; credits go to him for writing it.)

pobster’s picture

Thank you @kiamlaluno, this is better than the original patch which had parameter issues.

Martijn de Wit’s picture

Status: Needs review » Reviewed & tested by the community

kill two birds with one stone, nice.

Tested patch and works great.

mbovan’s picture

#5 works fine.

mbovan’s picture

I am attaching a patch that brings back space between examples added in #3 and removed in #5.

mbovan’s picture

This is the same patch as #9 made on top of Schema Metatag 8.x-1.4 release.

apaderno’s picture

Status: Reviewed & tested by the community » Needs work
+      '#description' => $this->t('Separate xpaths by comma. ex: @example',

ex is wrong because it's written at the start of a sentence. The correct sentence should be Separate xpaths by a comma, as in […].
I am not sure it should be XPATHs or xpaths, but I would keep that consistent with what other strings in the module use.

mbovan’s picture

Thanks for the review @kiamlaluno. Addressed #11.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Thanks.

edwardchiapet’s picture

Confirmed that the updated patch in #12 works great.

idimopoulos’s picture

+1. Can we get this in?

claudiu.cristea’s picture

Priority: Major » Critical

This breaks tests in other issues. Promoting ro Critical.

IT-Cru’s picture

+1. Would be nice to get this into 8.x-1.x-dev to fix broken testing for new/other issues.

Luke.Leber’s picture

+1 from me.

Applying this patch allows drupal-check to run successfully (and indicates that this module is most likely Drupal 9 compatible if the info.yml file is tweaked appropriately).

  • KarenS committed c6ed9ea on 8.x-1.x authored by mbovan
    Issue #3068796 by mbovan, davidburns, kiamlaluno: Fatal PHP syntax error...
KarenS’s picture

Status: Reviewed & tested by the community » Fixed

Sorry for the long delay in getting this in. Fixed. Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.