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 #113

Closed
kaloqndamqnov opened this issue Oct 2, 2018 · 6 comments
Closed

String could not be parsed as XML #113

kaloqndamqnov opened this issue Oct 2, 2018 · 6 comments

Comments

@kaloqndamqnov
Copy link

Symfony 3.4
/command-scheduler/detail/new

After i try to add first scheduled command.

DEBUG 11:13:27 event Notified event "console.command" to listener "Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand".
ERROR 11:13:27 console Error thrown while running command "list --format=xml". Message: "Warning: DOMDocument::createTextNode() expects parameter 1 to be string, object given"
DEBUG 11:13:27 event Notified event "console.error" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onException".
DEBUG 11:13:27 event Notified event "console.error" to listener "Symfony\Component\Console\EventListener\ErrorListener::onConsoleError".
DEBUG 11:13:27 console Command "list --format=xml" exited with code "1"
DEBUG 11:13:27 event Notified event "console.terminate" to listener "Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener::onTerminate".
DEBUG 11:13:27 event Notified event "console.terminate" to listener "Symfony\Component\Console\EventListener\ErrorListener::onConsoleTerminate".
DEBUG 11:13:27 event Notified event "console.terminate" to listener "Symfony\Bridge\Monolog\Handler\ConsoleHandler::onTerminate".
CRITICAL 11:13:27 request Uncaught PHP Exception Exception: "String could not be parsed as XML" at /var/www/symfony/vendor/jmose/command-scheduler-bundle/Service/CommandParser.php line 74
DEBUG 11:13:27 event Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".

`
image

AppKernel:
new JMose\CommandSchedulerBundle\JMoseCommandSchedulerBundle(),
Routing:

jmose_command_scheduler:
  resource: "@JMoseCommandSchedulerBundle/Resources/config/routing.yml"
  prefix:   /

Config:


jmose_command_scheduler:

  # Default directory where scheduler will write output files
  #  This default value assume that php bin/console is launched from project's root and that the directory is writable
  # if log_path is set to false, logging to files is disabled at all
  log_path: "%kernel.root_dir%/../scheduler/log"
  # This default value disables timeout checking (see monitoring), set to a numeric value (seconds) to enable it
#  lock_timeout: false
  # receivers for reporting mails
#  monitor_mail: []
  # set a custom subject for monitor mails (first placeholder will be replaced by the hostname, second by the date)
#  monitor_mail_subject: cronjob monitoring %s, %s
  # to send "everything's all right" emails to receivers for reporting mails set this value to "true" (see monitoring)
#  send_ok: false

  # Namespaces listed here won't be listed in the list
  excluded_command_namespaces:
  - _global
  - scheduler
  - server
  - container
  - config
  - generate
  - init
  - router

  # Doctrine manager
#  doctrine_manager: default

Composer:
"jmose/command-scheduler-bundle": "2.0.0",

@kaloqndamqnov
Copy link
Author

@J-Mose some help ?

@tkuska
Copy link

tkuska commented Oct 19, 2018

Try run php bin/console list --format=xml command, maybe it throws any error instead of XML result.

@horo42
Copy link

horo42 commented Oct 24, 2018

I had the same error. The problem was that two commands used the same shortcut. In my case it was "-s", used by PageBundle/Command/CloneSiteCommand, and FrameworkBundle/Console/Application.

Good luck

@j-guyon
Copy link
Owner

j-guyon commented Nov 14, 2018

The bundle internally run the native Symfony command bin/console list --format=xml to get existing commands.

If you have some deprecated command definition in your project, deprecated warning will turn the XML parsing into an error.

See https://github.com/symfony/symfony/blob/3.4/UPGRADE-3.4.md#httpkernel for more informations about how to fix it in your project.

If you can't fix the deprecation warning (command in an external bundle for example), you can silence it by excluding the event channel in the console handler.

monolog:
    handlers:
        console:
            type:  console
            channels: [!event]

@divined
Copy link

divined commented Jul 20, 2019

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

@numediaweb
Copy link

See what fixed it for me here: #133 (comment)

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

6 participants