Problem/Motivation

Trying to view rules returns error. DBLog shows
TypeError: PDOStatement::fetchAll(): Argument #2 must be of type int, string given in PDOStatement->fetchAll() (line 2293 of includes/database/database.inc).

Steps to reproduce

Proposed resolution

public static function `getTags()` in `RulesPluginUI` should call `fetchCol()` without any parameters. FetchCol() should only take int and default is 0, which is desired value.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 3245554-4-fetch-col.patch797 bytestr

Comments

selfsimilar created an issue. See original summary.

tr’s picture

Version: 7.x-2.12 » 7.x-2.x-dev

This usage of fetchCol() was added to Rules in #1100854: implement tagging support, almost 10 years ago. There is also another place fetchCol() is used improperly and that also needs to be fixed. I find it strange that no one has noticed this before.

What did you do that caused this error? You said "Trying to view rules" but I don't know what that means. Were you trying to create a View? If so, can you export the View so I can try to reproduce this?

selfsimilar’s picture

Sorry for the less than robust bug report. I was pretty tired and wooly-headed when I filed it.

When I say "Trying to view rules", I mean navigating to /admin/config/workflow/rules to view the default list of active and inactive rules. Unpatched, navigating to that URL on my system returns the bog standard error 'The website encountered an unexpected error. Please try again later.' and the PDO error is logged. I'm sure my system has some deep issues, as it's over ten years old and migrated from D6, but I haven't tried to recreate this on a fresh install, so I don't have a good way to reproduce the issue. However, fixing the call to fetchCol() addresses the issue for my machine.

I'm a bit swamped at the moment, but I'm happy to roll a patch fixing the improper calls to fetchCol() later this week when my current crisis is more resolved.

tr’s picture

Status: Active » Needs review
StatusFileSize
new797 bytes

Well here's the patch, it's simple enough and it fixes something that's obviously wrong. I'm just puzzled why it hasn't caused anyone problems in the past.

  • TR committed 3ef9835 on 7.x-2.x
    Issue #3245554 by selfsimilar, TR: `RulesPluginUI::getTags()` makes bad...
tr’s picture

Status: Needs review » Fixed

Committed #4. Thanks for finding this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.