Skip to content

watchdog:tail throws sql exception when using options or argument #5121

@mradcliffe

Description

@mradcliffe

Describe the bug

Running watchdog:tail with options or arguments throws an exception.

To Reproduce

Any of the following:

./vendor/bin/drush watchdog:tail --severity=3
./vendor/bin/drush watchdog:tail --type=php
./vendor/bin/drush watchdog:tail "anything"

Expected behavior

The command should succeed without an exception.

Actual behavior

An exception is thrown instead of output. Using MariaDB the exception message is:

SQLSTATE[HY093]: Invalid parameter number: mixed name and positional parameters: SELECT "w".*
FROM
"watchdog" "w"
WHERE (message LIKE :filter AND wid > ?)
ORDER BY "wid" DESC
LIMIT 10, OFFSET 0; Array
(
     [:filter] => "%anything%"
     [:wid] => 0
)

Workaround

No

System Configuration

Q A
Drush version? 10.6.2 or greater (code has not changed since #4767)
Drupal version? 9.3.x
PHP version 7.4.x with PDO driver mysql using MariaDB.
OS? Linux

Additional information

https://github.com/drush-ops/drush/blame/11.x/src/Drupal/Commands/core/WatchdogCommands.php#L147

This should be changed from a positional parameter to a named parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions