CommandSchedulerBundle icon indicating copy to clipboard operation
CommandSchedulerBundle copied to clipboard

String could not be parsed as XML

Open divined opened this issue 6 years ago • 5 comments

The same as in https://github.com/j-guyon/CommandSchedulerBundle/issues/113

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

divined avatar Jul 20 '19 15:07 divined

@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 ;)

z31fbras avatar Jul 26 '19 08:07 z31fbras

I don't have custom commands (

divined avatar Jul 26 '19 09:07 divined

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)

nitrique avatar Sep 21 '19 11:09 nitrique

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'));

Pidz-b avatar Oct 18 '19 08:10 Pidz-b

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!

numediaweb avatar Apr 22 '20 12:04 numediaweb