Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[YAML] Parser fails with empty new line #33082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sylfabre opened this issue Aug 9, 2019 · 4 comments · Fixed by #48022
Open

[YAML] Parser fails with empty new line #33082

sylfabre opened this issue Aug 9, 2019 · 4 comments · Fixed by #48022

Comments

@sylfabre
Copy link
Contributor

sylfabre commented Aug 9, 2019

Symfony version(s) affected: 4.3.3

Description
The YAML::parse() method fails on this string:

---
controller_organisation_membres_inc_mailer:
  alert:
    emailSent: 1 email a été envoyé.
    emailsSentInHour: "{nb} emails sont programmés pour être envoyés dans l'heure qui vient."
    error: Une erreur s'est produite.
    oneEmailSent: 1 email a été envoyé. Certains utilisateurs (sans adresse email) n'ont pas été ajoutés à cette liste d'envoi.
    scheduledEmailsSent: "{nb} emails sont programmés pour être envoyés dans l'heure qui vient. Certains utilisateurs (sans adresse email) n'ont pas été ajoutés à cette liste d'envoi."
    selectUser: Veuillez sélectionner au moins une personne.
    usersNoEmail: Les utilisateurs sélectionnés n'ont pas d'email.
  cancel: Annuler
  communicate: 'VOUS SAVEZ COMMUNIQUER !

'
  fillAdress: Veuillez indiquer une adresse de réponse.
  fillMessage: Veuillez indiquer le contenu de votre message.
  fillSubject: Veuillez indiquer le sujet de votre message.
  form:
    userMailer:
      usersMailerLightboxButtonSite: Afficher un bouton d'accès au site en bas du mail
      usersMailerLightboxDocumentIds: Joindre des fichiers
      usersMailerLightboxMessage:
        label: Votre message *
        placeholder: Votre message *
      usersMailerLightboxReplyTo:
        label: Répondre à
        placeholder: Répondre à
      usersMailerLightboxSubject:
        label: Sujet *
        placeholder: Sujet *
  h2:
    createCampagne: Créez une campagne d'emailing
    sendMessage: ou envoyez un message rapidement
  nbEmailSent: 'Déjà {nb} emails envoyés ce mois ! Changez de dimension, passez à un abonnement payant.

'
  pricing: Découvrir les tarifs
  submit: Envoyer
  template:
    button:
      emailing: Créer une nouvelle campagne
  trialMode: 'Vous êtes actuellement en période d''essai : 5 emails maximum seront envoyés.'
  warning: Attention, créez une campagne si vous souhaitez obtenir des statistiques sur cet envoi.

How to reproduce
YAML::parse($previousString);
Throws this exception: Malformed inline YAML string in vendor/symfony/yaml/Inline.php on line 120

Possible Solution
controller_organisation_membres_inc_mailer.communicate has empty new lines.
Same with nbEmailSent

Additional context
https://yaml-online-parser.appspot.com/ successfully parses the string

@xabbuh
Copy link
Member

xabbuh commented Nov 25, 2020

Status: Reviewed

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@RazeSoldier
Copy link

I also encountered this problem.

symfony/yaml version(s) affected: 5.3.6

Description
The YAML::parse() method fails on this string:

27399:
    basePrice: 10000.0
    description:
        de: Die erste von den Minmatar geschaffene große Rakete. Die aus reaktiven
            Metalllegierungen gebaute Scourge Cruise Missile ist darauf ausgelegt,
            ihr Ziel unter allen Umständen zu erreichen. Lenk- und Antriebssystem
            sind gallentischen Ursprungs und wurden ursprünglich in Drohnen verwendet.
            Sie machen die Rakete schnell und wendig, trotz ihrer schweren Sprengladung.
        en: The first Minmatar-made large missile. Constructed of reactionary alloys,
            the Scourge cruise missile is built to get to the target. Guidance and
            propulsion systems are of Gallente origin and were initially used in drones,
            making this a nimble projectile despite its heavy payload.
        fr: Il s'agit du premier grand missile fabriqué par les Minmatar. Produit
            à partir d'alliages réactifs, le missile de croisière Scourge est conçu
            pour atteindre sa cible quoi qu'il arrive. Les systèmes de propulsion
            et de guidage sont d'origine gallente et sont normalement utilisés pour
            la fabrication de drones. Ces technologies permettent à ce missile d'être
            très rapide, et ce malgré sa charge très importante.
        ja: 初のミンマター製大型ミサイル。反発性合金で作られたスコージクルーズミサイルは、ターゲットに命中することを主眼として設計されている。誘導および推進システムにはガレンテのドローンにも採用されていた装置を使い、弾頭の重さのわりに機敏な飛行を実現している。
        ru: 'Первая большая ракета, выпущенная в республике Минматар. Ракета дальнего
            боя Scourge сконструирована из реакционных сплавов. Системы наведения
            и двигательная установка разработаны Gallente. Они первоначально использовались
            в дронах, что позволяет обеспечить Trauma быстроту и маневренность, несмотря
            на существенную массу боеголовки.

'

Stacktrace:

Symfony\Component\Yaml\Exception\ParseException 

  Malformed inline YAML string at line 25.

  at vendor\symfony\yaml\Parser.php:1229
    1225▕                 $cursor = 0;
    1226▕             }
    1227▕         } while ($this->moveToNextLine());
    1228▕ 
  ➜ 1229▕         throw new ParseException('Malformed inline YAML string.');
    1230▕     }
    1231▕ 
    1232▕     private function lexUnquotedString(int &$cursor): string
    1233▕     {

  1   vendor\symfony\yaml\Parser.php:776
      Symfony\Component\Yaml\Parser::lexInlineQuotedString()

  2   vendor\symfony\yaml\Parser.php:352
      Symfony\Component\Yaml\Parser::parseValue("'Первая большая ракета, выпущенная в республике Минматар. Ракета дальнего", "mapping")

Additional context

  • If I indent the bottom single quote and align the upper single quote, symfony/yaml can parse it.
  • https://yamlvalidator.com/ successfully parses the string.

@xabbuh
Copy link
Member

xabbuh commented Nov 14, 2024

reopening as the merged PR has been reverted in acb4372

@xabbuh xabbuh reopened this Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants