Bug du sitemap.php

garys02garys02 Member
28 oct. modifié dans Discussions générales

Bonjour,

quand j'ouvre l'url monsiteamoi.fr/sitemap.php j'ai cette erreur :

This page contains the following errors:
error on line 320 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.

Puis tous les url s'affichent en ligne.

Comment refaire afficher le sitemap normalement ?

Voici le code présent à la fin apres la balise urlset :

`</urlset>
<style>
    #bug-notification:not(:checked) + div {
        display: none;
    }
</style>
<input type="checkbox" id="bug-notification" checked style="display: none;"/>
<div  id="fatal-error" style="
  position: fixed;
  top: 5vh;
  bottom: 5vh;
  width: 80rem;
  left: calc(50vw - 40rem);
  padding: 0.5rem 1rem;
  background-color: #555;
  z-index: 9999;
">
    <div style="text-align: end;">
        <label for="bug-notification" style="display: inline; padding: 0.2rem; background-color: #eee;">❌</label>
    </div>
    <pre style="margin: 0; padding: 0 0 1rem; max-height: calc(100% - 2rem); background-color: inherit;"><code style="color: lime;">Fatal error :
type : 8 E_NOTICE - See https://www.php.net/manual/fr/errorfunc.constants.php#constant.e-notice
message : Trying to access array offset on value of type null 
file : /core/lib/class.plx.motor.php 
line : 766 
</code></pre>
</div>
Mots clés:

Réponses

  • bazooka07bazooka07 PluXml Lead Developer, Moderator

    Bonjour,

    Numéros de versions de PluXml et de PHP ?
    ET éventuellement liste des plugins utilisés.

  • bazooka07bazooka07 PluXml Lead Developer, Moderator

    Bonjour,

    Dans la fonction parseArticle() dans le fichier core/lib/class.plx.motor.php, modifie les lignes relatives à thumbnail,.... dans le tableau $art comme suit :

    'thumbnail'         => isset($iTags['thumbnail']) ? plxUtils::getValue($values[$iTags['thumbnail'][0]]['value']) : '',
    'thumbnail_title'   => isset($iTags['thumbnail_title']) ? plxUtils::getValue($values[$iTags['thumbnail_title'][0]]['value']) : '',
    'thumbnail_alt'     => isset($iTags['thumbnail_alt']) ? plxUtils::getValue($values[$iTags['thumbnail_alt'][0]]['value']) : '',
    
    
  • garys02garys02 Member
    1 nov. modifié

    PluXml 5.8.21 - php 7.4.33 - plugins : mybetterurls1.5.5,url canonique 1.0,mysubcategories1.3. Ca fait plusieurs fois que j'ai ce problème, je sais pas à quel moment il se déclenche, mais ça vient au fur et à mesure que je crée des articles, je sais pas si c'est à cause d'un plugin ou autre chose...

    C'était la ligne titlehtml_tag je pense qui posait probleme, j'ai corrigé toute les lignes à la fois dans le class.plx.motor.php et là ça marche, merci.

    La correction ligne 755 :


    # Recuperation des valeurs de nos champs XML 'title' => isset($iTags['title']) ? plxUtils::getValue($values[$iTags['title'][0]]['value']) : '', 'allow_com' => isset($iTags['allow_com']) ? plxUtils::getValue($values[$iTags['allow_com'][0]]['value'], 0) : 0, 'template' => isset($iTags['template']) ? plxUtils::getValue($values[$iTags['template'][0]]['value'], 'article.php') : 'article.php', 'chapo' => isset($iTags['chapo']) ? plxUtils::getValue($values[$iTags['chapo'][0]]['value']) : '', 'content' => isset($iTags['content']) ? plxUtils::getValue($values[$iTags['content'][0]]['value']) : '', 'tags' => isset($iTags['tags']) ? plxUtils::getValue($values[$iTags['tags'][0]]['value']) : '', 'meta_description' => isset($meta_description) ? plxUtils::getValue($values[$meta_description]['value']) : '', 'meta_keywords' => isset($meta_keywords) ? plxUtils::getValue($values[$meta_keywords]['value']) : '', 'title_htmltag' => isset($iTags['title_htmltag']) ? plxUtils::getValue($values[$iTags['title_htmltag'][0]]['value']) : '', 'thumbnail' => isset($iTags['thumbnail']) ? plxUtils::getValue($values[$iTags['thumbnail'][0]]['value']) : '', 'thumbnail_title' => isset($iTags['thumbnail_title']) ? plxUtils::getValue($values[$iTags['thumbnail_title'][0]]['value']) : '', 'thumbnail_alt' => isset($iTags['thumbnail_alt']) ? plxUtils::getValue($values[$iTags['thumbnail_alt'][0]]['value']) : '',
  • bazooka07bazooka07 PluXml Lead Developer, Moderator

    Les images d'accroche (thumbnail) ont été introduites par la version 5.7 de PluXml.
    Hélas pour le passage de la version 5.6 à 5.7, les fichiers d'articles existants ne sont pas mis à jour pour ces thumbnails.
    Cette absence était prise en compte par la fonction plxMotor::parseArticle() de la version 5.7.
    Mais hélas, ce correctif a sauté avec la version 5.8.5.
    Les tests isset(...) sont juste nécessaires pour thumbnail, thumbnail_alt et thumbnail_title. Ils sont inutiles pour les autres clés.
    Le bug n'est pas spécifique à sitemap.php mais à tous les articles créés avec PluXml version < 5.7.

    Le correctif sera intégré dans la prochaine version 5.8.22 de PluXml;

  • garys02garys02 Member
    3 nov. modifié

    Ok c'est quand même bien d'avoir ajouté ça.
    Il ne manquera que les balise schema et opengraph.
    Merci

Connectez-vous ou Inscrivez-vous pour répondre.