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

String could not be parsed as XML #133

Open
divined opened this issue Jul 20, 2019 · 5 comments
Open

String could not be parsed as XML #133

divined opened this issue Jul 20, 2019 · 5 comments

Comments

@divined
Copy link

divined commented Jul 20, 2019

The same as in #113

php bin/console list --format=xml - dont throw error, but i still get String could not be parsed as XML

@z31fbras
Copy link

z31fbras commented Jul 26, 2019

@divined Do you have a __construct function in one of your commands where you do something else than dependency injection?
This was the error cause for me ;)

@divined
Copy link
Author

divined commented Jul 26, 2019

I don't have custom commands (

@nitrique
Copy link

I've got same error with snc/redis-bundle enabled in version 2 because it used ContainerAwareCommand in SF4.3 wich throw exception. Solved by updating this package.

If you have an error, try searching "ContainerAwareCommand" with vscode in vendors folder (don't forgot to add an * to included files to search in any folder)

@Pidz-b
Copy link

Pidz-b commented Oct 18, 2019

I have the same error.
In my case it is Monolog that is causing this issue.

It writes DEBUG messages to php://memory when the list command is ran, and thus the stream is not solely XML.

I solved it by adding an ugly line of code to the CommandParser on line 76:

$xml = substr($xml, strpos($xml, '<?xml'));

@numediaweb
Copy link

numediaweb commented Apr 22, 2020

I have the same issue (Symfony 4.4), the XML passed into extractCommandsFromXML is

11:35:40 DEBUG     [snc_redis] Executing command "GET domain_doctrine[App\Entity\DomainStatistic$CLASSMETADATA][1]"
[
  "tags" => [
    "domain"
  ],
  "url" => "/command-scheduler/detail/new",
  "ip" => "192.168.33.1",
  "http_method" => "GET",
  "server" => "domain.dev",
  "referrer" => "https://domain.dev/command-scheduler/list"
]
<?xml version="1.0" encoding="UTF-8"?>

When I checked the monolg config for dev env:

monolog:
    handlers:
...
        console:
            type: console
            process_psr_3_messages: false
            channels: ['!event', '!doctrine', '!console']

Which I changed to:

monolog:
    handlers:
...
        console:
            type: console
            process_psr_3_messages: false
            channels: ['console']

This fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants