Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Example with parse error: http://cgit.drupalcode.org/piwik/tree/piwik.info.yml?h=8.x-1.x&id=64b1b3...
The error:
11:49:05 WD php: Symfony\Component\Yaml\Exception\ParseException: Unexpected [error]
11:49:05 characters near "s pages.'" in
11:49:05 "\/var\/tmp\/project_dependency_sourcecode_directory\/piwik\/piwik.info.yml"
11:49:05 at line 3 (near "description: 'Adds Piwik javascript tracking code to
11:49:05 all your site's pages.'"). in Symfony\Component\Yaml\Inline::parse()
11:49:05 (line 76 of
11:49:05 /var/www/drupal.org/htdocs/sites/all/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php).
11:49:05 Symfony\Component\Yaml\Exception\ParseException: Unexpected characters near "s pages.'" in "\/var\/tmp\/project_dependency_sourcecode_directory\/piwik\/piwik.info.yml" at line 3 (near "description: 'Adds Piwik javascript tracking code to all your site's pages.'"). in Symfony\Component\Yaml\Inline::parse() (line 76 of /var/www/drupal.org/htdocs/sites/all/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php).
11:49:05 Drush command terminated abnormally due to an unrecoverable error. [error]
Comment | File | Size | Author |
---|---|---|---|
#3 | project_dependency-handle-yaml-parse-errors-gracefully-2605590-3.patch | 1.13 KB | trobey |
Comments
Comment #2
trobey CreditAttribution: trobey as a volunteer commentedFirst, passing the filename to this function is now deprecated:
http://symfony.com/doc/current/components/yaml/introduction.html
So I have wrapped the filename with file_get_contents(). I have added a try-catch block and output any errors to watchdog. So here is the new code:
I hacked the code to test the Piwik example above. The $info array returned when the parsing error occurs is
The dependencies returned are
The watchdog error is
Should I change the severity? Does this behavior make sense?
I will post a patch shortly.
Comment #3
trobey CreditAttribution: trobey as a volunteer commentedComment #5
trobey CreditAttribution: trobey as a volunteer commentedI changed the severity level to error and committed it so it could be included in the next release.