Comments

AdamEvertsson created an issue. See original summary.

damienmckenna’s picture

That's odd, thanks for reporting it. Did you clear/rebuild the caches after updating the first time?

adamevertsson’s picture

When I got the error message I reverted the code to 1.0, cleared cache (via Drupal, not Drush or simliar) and then tried again. Same error. I then proceeded with the incremental (is that the right word in English) update, and it went well.

trong.nguyen.tcec’s picture

Status: Fixed » Needs work

if you run update.php/selection, site will get error.
I think metatag should ignore any replacement on /update.php
Try this code on metatag/src/MetatagManager.php (namespace Drupal\metatag\MetatagManager)

  public function generateRawElements(array $tags, $entity = NULL) {
..... 
@@ -509,10 +502,14 @@

 
         if ($tag->type() === 'image') {
           $processed_value = $this->tokenService->replace($tag->value(), $token_replacements, ['langcode' => $langcode]);
-        }
-        else {
+                } else {
+                    $request = \Drupal::request();
+                    if ($request->getBaseUrl() == "/update.php") {
+                        $processed_value = "";
+                    } else {
           $processed_value = PlainTextOutput::renderFromHtml(htmlspecialchars_decode($this->tokenService->replace($tag->value(), $token_replacements, ['langcode' => $langcode])));
         }
+                }
 
         // Now store the value with processed tokens back into the plugin.
         $tag->setValue($processed_value);
......
 }
damienmckenna’s picture

Version: 8.x-1.5 » 8.x-1.x-dev
Status: Needs work » Active

That's worth considering.

StepanISK’s picture

Issue summary: View changes

Thank you. #4 works for me

chiefme’s picture

Same problem. #4 worked for me too.

quixxel’s picture

#4 works for me too.

danpeig’s picture

Having the same problem. Metatag had to be uninstalled so I could run the update.php/selection script.
Drupal 8.5.3 running on PHP 7.1.17.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1020 bytes

The code from #4 in patch format.

cprofessionals’s picture

Thank you this patch fixed the issue for me.

damienmckenna’s picture

StatusFileSize
new588 bytes

Out of interest, does this work too?

rjg’s picture

#10 and #12 both worked for me

damienmckenna’s picture

Status: Needs review » Fixed
Parent issue: » #2957104: Plan for Metatag 8.x-1.6

Committed. Thank you for your help tracking this down and to trong.nguyen.tcec for working out a potential fix.

Status: Fixed » Closed (fixed)

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