Skip to content
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

The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory"). #30

Closed
seanhamlin opened this issue Apr 11, 2019 · 12 comments
Labels
autoloading Problems with autoloading phpstan-drupal Issue relates to PHPStan Drupal extension

Comments

@seanhamlin
Copy link

seanhamlin commented Apr 11, 2019

$ drupal-check -d docroot/modules/contrib/imce

In Inline.php line 301:

  The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory").

Running 1.0.6 on PHP 7.2. Every command I try produces the same cryptic error message.

Running with -vvv :

$ drupal-check -d docroot/modules/contrib/imce -vvv
Performing deprecation checks
Current working directory: /Users/sean.hamlin/Sites/Corvette
Using Drupal root: /Users/sean.hamlin/Sites/Corvette/docroot
Using vendor root: /Users/sean.hamlin/Sites/Corvette/vendor
Using autoloader: /Users/sean.hamlin/Sites/Corvette/vendor/autoload.php
PHP Fatal error:  Uncaught Symfony\Component\Yaml\Exception\ParseException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory"). in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php:301
Stack trace:
#0 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php(94): Symfony\Component\Yaml\Inline::parseScalar('@config.factory', 0, NULL, 15, true, Array)
#1 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(719): Symfony\Component\Yaml\Inline::parse('@config.factory', 0, Array)
#2 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(201): Symfony\Component\Yaml\Parser->parseValue('@config.factory', 0, 'sequence')
#3 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(464): Symfony\Component\Yaml\Parser->doParse('- @config.facto...', 0)
#4 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(323): Symfony\Component\Yaml\Parser->parseBlock(9, '- @config.facto...', 0)
#5 phar:https:///usr/loc in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php on line 301

Fatal error: Uncaught Symfony\Component\Yaml\Exception\ParseException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory"). in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php:301
Stack trace:
#0 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php(94): Symfony\Component\Yaml\Inline::parseScalar('@config.factory', 0, NULL, 15, true, Array)
#1 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(719): Symfony\Component\Yaml\Inline::parse('@config.factory', 0, Array)
#2 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(201): Symfony\Component\Yaml\Parser->parseValue('@config.factory', 0, 'sequence')
#3 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(464): Symfony\Component\Yaml\Parser->doParse('- @config.facto...', 0)
#4 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(323): Symfony\Component\Yaml\Parser->parseBlock(9, '- @config.facto...', 0)
#5 phar:https:///usr/loc in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php on line 301
@mglaman
Copy link
Owner

mglaman commented Apr 12, 2019

Yes, so this is a problem with the phpstan-drupal extension and parsing the services.yml in imce

@mglaman
Copy link
Owner

mglaman commented Apr 12, 2019

There's code to workaround factories, we'll need to review the imce.services.yml and open an issue in phpstan-drupal. I don't want to transfer this issue just incase more people run into it.

@mglaman
Copy link
Owner

mglaman commented Apr 12, 2019

  imce.route_subscriber:
    class: Drupal\imce\Routing\ImceRouteSubscriber
    arguments: ['@config.factory']
    tags:
      - { name: event_subscriber }

I have no idea why this is freaking out on IMCE and not anywhere else.

@seanhamlin what version of IMCE do you have, -dev or a tagged release

@seanhamlin
Copy link
Author

seanhamlin commented Apr 13, 2019

This seems to happen no matter what module I scan. Another example.

$ drupal-check -d docroot/modules/contrib/google_analytics -vvv
Performing deprecation checks
Current working directory: /Users/sean.hamlin/Sites/Corvette
Using Drupal root: /Users/sean.hamlin/Sites/Corvette/docroot
Using vendor root: /Users/sean.hamlin/Sites/Corvette/vendor
Using autoloader: /Users/sean.hamlin/Sites/Corvette/vendor/autoload.php
PHP Fatal error:  Uncaught Symfony\Component\Yaml\Exception\ParseException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory"). in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php:301
Stack trace:
#0 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php(94): Symfony\Component\Yaml\Inline::parseScalar('@config.factory', 0, NULL, 15, true, Array)
#1 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(719): Symfony\Component\Yaml\Inline::parse('@config.factory', 0, Array)
#2 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(201): Symfony\Component\Yaml\Parser->parseValue('@config.factory', 0, 'sequence')
#3 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(464): Symfony\Component\Yaml\Parser->doParse('- @config.facto...', 0)
#4 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(323): Symfony\Component\Yaml\Parser->parseBlock(9, '- @config.facto...', 0)
#5 phar:https:///usr/loc in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php on line 301

Fatal error: Uncaught Symfony\Component\Yaml\Exception\ParseException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory"). in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php:301
Stack trace:
#0 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php(94): Symfony\Component\Yaml\Inline::parseScalar('@config.factory', 0, NULL, 15, true, Array)
#1 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(719): Symfony\Component\Yaml\Inline::parse('@config.factory', 0, Array)
#2 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(201): Symfony\Component\Yaml\Parser->parseValue('@config.factory', 0, 'sequence')
#3 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(464): Symfony\Component\Yaml\Parser->doParse('- @config.facto...', 0)
#4 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(323): Symfony\Component\Yaml\Parser->parseBlock(9, '- @config.facto...', 0)
#5 phar:https:///usr/loc in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php on line 301

And another.

$ drupal-check -d docroot/modules/contrib/responsive_favicons -vvv
Performing deprecation checks
Current working directory: /Users/sean.hamlin/Sites/Corvette
Using Drupal root: /Users/sean.hamlin/Sites/Corvette/docroot
Using vendor root: /Users/sean.hamlin/Sites/Corvette/vendor
Using autoloader: /Users/sean.hamlin/Sites/Corvette/vendor/autoload.php
PHP Fatal error:  Uncaught Symfony\Component\Yaml\Exception\ParseException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory"). in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php:301
Stack trace:
#0 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php(94): Symfony\Component\Yaml\Inline::parseScalar('@config.factory', 0, NULL, 15, true, Array)
#1 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(719): Symfony\Component\Yaml\Inline::parse('@config.factory', 0, Array)
#2 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(201): Symfony\Component\Yaml\Parser->parseValue('@config.factory', 0, 'sequence')
#3 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(464): Symfony\Component\Yaml\Parser->doParse('- @config.facto...', 0)
#4 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(323): Symfony\Component\Yaml\Parser->parseBlock(9, '- @config.facto...', 0)
#5 phar:https:///usr/loc in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php on line 301

Fatal error: Uncaught Symfony\Component\Yaml\Exception\ParseException: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 10 (near "- @config.factory"). in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php:301
Stack trace:
#0 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php(94): Symfony\Component\Yaml\Inline::parseScalar('@config.factory', 0, NULL, 15, true, Array)
#1 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(719): Symfony\Component\Yaml\Inline::parse('@config.factory', 0, Array)
#2 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(201): Symfony\Component\Yaml\Parser->parseValue('@config.factory', 0, 'sequence')
#3 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(464): Symfony\Component\Yaml\Parser->doParse('- @config.facto...', 0)
#4 phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Parser.php(323): Symfony\Component\Yaml\Parser->parseBlock(9, '- @config.facto...', 0)
#5 phar:https:///usr/loc in phar:https:///usr/local/bin/drupal-check/vendor/symfony/yaml/Inline.php on line 301

@mglaman mglaman added this to Needs triage in Issue triage May 3, 2019
@mglaman mglaman moved this from Needs triage to Needs Testing in Issue triage May 3, 2019
@JDDoesDev
Copy link

JDDoesDev commented May 7, 2019

I'm also running into this issue whether checking contrib or custom modules. My output is almost identical to @seanhamlin's above.

IMCE version: '8.x-1.6'

@mglaman
Copy link
Owner

mglaman commented May 7, 2019

Thanks! I'm guessing IMCE has something which is causing checking anything in that Drupal site to explode.

@mglaman mglaman added autoloading Problems with autoloading phpstan-drupal Issue relates to PHPStan Drupal extension labels May 7, 2019
@JDDoesDev
Copy link

@mglaman this is actually coming from the brightcove module in my case.

Full call stack:

Symfony\Component\Yaml\Inline::parseScalar (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Inline.php:301)
Symfony\Component\Yaml\Inline::parse (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Inline.php:94)
Symfony\Component\Yaml\Parser->parseValue (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:719)
Symfony\Component\Yaml\Parser->doParse (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:201)
Symfony\Component\Yaml\Parser->parseBlock (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:464)
Symfony\Component\Yaml\Parser->doParse (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:323)
Symfony\Component\Yaml\Parser->parseBlock (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:464)
Symfony\Component\Yaml\Parser->doParse (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:323)
Symfony\Component\Yaml\Parser->parseBlock (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:464)
Symfony\Component\Yaml\Parser->doParse (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:323)
Symfony\Component\Yaml\Parser->parse (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:96)
Symfony\Component\Yaml\Parser->parseFile (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Parser.php:63)
Symfony\Component\Yaml\Yaml::parseFile (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/yaml/Yaml.php:56)
PHPStan\DependencyInjection\DrupalExtension->loadConfiguration (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/mglaman/phpstan-drupal/src/DependencyInjection/DrupalExtension.php:134)
Nette\DI\Compiler->processExtensions (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/di/src/DI/Compiler.php:215)
Nette\DI\Compiler->compile (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/di/src/DI/Compiler.php:175)
PHPStan\DependencyInjection\Configurator->generateContainer (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/bootstrap/src/Bootstrap/Configurator.php:306)
call_user_func_array:{phar:https:///var/www/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/di/src/DI/ContainerLoader.php:125} (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/di/src/DI/ContainerLoader.php:125)
Nette\DI\ContainerLoader->generate (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/di/src/DI/ContainerLoader.php:125)
Nette\DI\ContainerLoader->loadFile (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/di/src/DI/ContainerLoader.php:85)
Nette\DI\ContainerLoader->load (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/di/src/DI/ContainerLoader.php:47)
PHPStan\DependencyInjection\Configurator->loadContainer (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/bootstrap/src/Bootstrap/Configurator.php:267)
PHPStan\DependencyInjection\Configurator->createContainer (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/nette/bootstrap/src/Bootstrap/Configurator.php:242)
PHPStan\DependencyInjection\ContainerFactory->create (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/phpstan/phpstan/src/DependencyInjection/ContainerFactory.php:64)
PHPStan\Command\CommandHelper::begin (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/phpstan/phpstan/src/Command/CommandHelper.php:144)
DrupalCheck\Command\CheckCommand->execute (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/src/Command/CheckCommand.php:129)
DrupalCheck\Command\CheckCommand->run (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/console/Command/Command.php:255)
DrupalCheck\Application->doRunCommand (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/console/Application.php:908)
DrupalCheck\Application->doRun (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/console/Application.php:269)
DrupalCheck\Application->run (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/vendor/symfony/console/Application.php:145)
require (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check/drupal-check:60)
{main} (/Users/james.flynn/git/mysite/.docksal/addons/drupal-check/scripts/drupal-check:5)

@snpdev
Copy link

snpdev commented Jun 17, 2019

I have a similar error when checking any module, custom or contrib, e.g.

user@dev:/usr/local/www/nginx/dev/modules/custom # drupal-check -a procurements

In Inline.php line 301:

  The reserved indicator "@" cannot start a plain scalar; you need to quote t
  he scalar at line 5 (near "- @entity_field.manager").

Running PHP 7.2.10.

@mglaman
Copy link
Owner

mglaman commented Jun 19, 2019

If there's a problem in one line of code, it'll break inspecting any code.

@snpdev can you see what service is providing @entity_field.managerin the array YAML format versus inline? It'll help track this down and make it testable. Does procurements have a services.yml which is injecting entity_field.manager? If so, can you post the snippet?

@snpdev
Copy link

snpdev commented Jun 19, 2019

@mglaman, Thanks for your reply. The error is not isolated to our custom procurements module. It occurs when we check any module. One of our developers is exploring this further and will respond.

@mglaman
Copy link
Owner

mglaman commented Jun 19, 2019 via email

@wvanfleet
Copy link

wvanfleet commented Jan 20, 2020

Edit: I solved the problem!! I had to put the quotes around "@controller.helper". I had put them just around @"controller.helper".

I am not an IT person, so please help me with non-technical terms as much as possible.

I today have updated my phpBB forum, apparently basically successfully, except that in the Administrative Control Panel I get this exact message, saying that all extensions are temporarily disabled.

I went to the location the error message showed, and indeed there were three @'s followed by something not included in quotes. So I tried editing by using single quotes and double quotes, but I still get the same message in the Administrative Control Panel.

The message begins:
[
phpBB encountered an error building the container due to an installed extension. For this reason, all extensions have been temporarily disabled. Please try purging your forum cache. All extensions will automatically be re-enabled once the container error is resolved. If this error continues, please visit phpBB.com for support.

Exception: The file "/home/wvanfleet19/public_html/phpBB3/ext/hifikabin/translate/config/services.yml" does not contain valid YAML: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 5 (near "- @controller.helper").
]

I also renamed the cache folder, as my way of "purging" it.

I actually do not know what extensions I have and how important they are, so I am continuing to make the Forum available, and I can't tell that anything is wrong. But I assume that something is not right. I even wonder if these extensions (it looks like there are 10 of them) have been put there by a hacker or bot, since I don't remember over the years having put in extensions. If they are bad extensions, I don't know how to get rid of them, but I am making the assumption for now that they are legitimate. I just would like to see that awful message in red no longer being in the ACP.

I hope someone can help me.

Edit: I just noticed that there were two quotes around [controller.helper], so I removed one set, because that was the way the original message displayed. So apparently after I added the quotes, it changed the message in the ACP to [...scalar at line 5 (near "- @"controller.helper"")]. That would mean to me that a new judgement was being made after my putting in the quotes, but that my doing so did not stop the same message from coming to me in the ACP.

Edit: Problem solved. See Edit at beginning. I'm learning. That awful message in red in the ACP is gone!

@mglaman mglaman closed this as completed Feb 4, 2022
Issue triage automation moved this from Needs Testing to Closed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autoloading Problems with autoloading phpstan-drupal Issue relates to PHPStan Drupal extension
Projects
Issue triage
  
Closed
Development

No branches or pull requests

5 participants