Getting the following error when filtering log messages in /admin/reports/dblog.
Error occors when one or more 'type' and 'severity' is selected, 'No log messages available.' when only 'type' is selected.
PDOException: SELECT w.wid AS wid, w.uid AS uid, w.severity AS severity, w.type AS type, w.timestamp AS timestamp, w.message AS message, w.variables AS variables, w.link AS link, u.name AS name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE ((w.type = ':s') AND (w.severity = :d)) - Array ( [0] => actions [1] => 2 ) SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in dblog_overview() (line 74 of /Applications/XAMPP/xamppfiles/htdocs/drupal/head/modules/dblog/dblog.admin.inc).
Comments
Comment #1
timmillwoodUpgraded /modules/dblog/dblog.admin.inc to dbtng.
Comment #2
damien tournoud commentedThe patch looks perfect, but I fear we don't have any tests for that yet. Why not adding some?
Comment #3
timmillwoodCouldn't of done it without Berdir's help.
Will work on some tests.
Comment #4
webchickThere was quite a bit of discussion on IRC that led to the creation of this patch. I'd like to see a walkthrough about the changes that were made given here so that this mentoring isn't lost.
Comment #5
berdirA few minor things..
the second line is wrongly indented.
Maybe we should rename where to field, to reflect the value change..
You need to add documentation for $query, have a look at other functions with parameters for examples. And it might make sense to replace "Build query.." with "Extend query object.. " or something like that.
Comment #6
berdirAnother possibility to resolve this.. #450666: Filter DB Extender
Comment #7
Brigadier commentedre #2, I wrote a patch to test this and it's working - #276591: TestingParty08: dblog.admin.inc. The test I wrote fails because of this bug (which I take to mean the test is doing its job). I expect that if both this patch and the other are applied then things should be happy but I haven't tried that yet.
Comment #8
deekayen commentedSo to summarize, before patching, filtering on type for dblog doesn't work - it shows 0 results. Some of this patch was apparently committed already, so I re-rolled it and merged in #276591: TestingParty08: dblog.admin.inc so there will be tests on the filter now.
Comment #9
berdirThis still needs a @param line in the api docs and the interface should be added to the function definition, like this:
This is to enforce that it can only be called with a proper $query object.
AFAIK we don't explicitly test this usually. If an error happens on the site, it should be displayed as a exception automatically anyway.
Other than that, the patch looks good.
Comment #10
deekayen commentedIncludes the revisions noted in #9.
Comment #12
deekayen commentedI just rolled this again and got the same patch. I call shenanigans. Re-test.
Comment #14
webchickMore shenanigans...
Sorry, we're testing out some new testing slaves this evening.
Comment #15
dries commented- Let's not abbreviate $severity to $sev. Let's write $severity.
- We don't usually glue words together; filterinclude should be filter-include. Ditto for filterexclude.
Comment #16
deekayen commentedMakes revisions requested in #15
Comment #17
deekayen commentedDoesn't pass coder review.
Comment #18
deekayen commentedNow adds revisions from #15 + code style fixes.
Comment #20
berdirDo not fix code style stuff unless you touch the code anyway. See http://webchick.net/please-stop-eating-baby-kittens. Note that neither ipv4 nor ipv6 will ever contain non-ascii characters, so that does not make sense. It might for others, but not in this patch....
Comment #21
deekayen commentedFixes #20. The failures in #19 don't make sense to me. Investigating.
Comment #22
deekayen commented#21 seems to resolve #19 on my local environment.
Comment #23
dries commentedCoding style needs more work still. For example:
// be sure the ...should start with capital B and end with a point. Also need line break before code comments.Almost there!
Comment #24
deekayen commentedFixes #23 comments.
Comment #26
berdirOh here it is, bumping the issue :)
I think this should even be critical since the dblog filter form is not usable right now and this *really* needs to be converted to DBTNG.
Patch probably only needs a re-roll, will do this soon...
Comment #27
berdirOk, it seems that the original bug has been fixed, so this only needs to be converted to DBTNG, similiar to other build filter query functions.
This isn't critical then...
Attaching a updated patch and also add a multiple types condition test to the existing testFilter test instead of the above test function.
Comment #28
moshe weitzman commentedforgot the patch?
Comment #29
berdirUps...
Comment #30
joachim commentedThe patch makes some comment and documentation tweaks which while good are patch creep.
If we're going to creep this patch, I'd say that building half the query in one function and half in another, and at the other end of the file to boot, is a bit of a WTF -- how about we fix that?
Comment #31
berdir#29: 445482_PDOException_reroll.patch queued for re-testing.
Hm. I could remove the documentation fixes, but they are in the same function and minor - just two changed lines and no text changes.
Not sure about removing the function. We have similiar functions for node and user filter forms and it doesn't hurt to have them.
Comment #32
Freso commentedSurprisingly doesn't apply anymore. :)
Comment #33
Freso commentedA reroll of the reroll by Berdir attached. Only one instance of creep removed, but going to have it run through testing first to see if the functionality is even up to snuff before messing more with it.
Comment #34
berdirFixing/Improving multiple things is usually discouraged, because it could possibly result in unecessary conflicts and makes patches harder to review and get committed. http://webchick.net/please-stop-eating-baby-kittens is a good read, in case you don't know it yet.
Comment #36
Freso commented@Berdir: Quoting myself here:
This was just a simple re-roll of your code to the latest HEAD of the 8.x branch. Please do feel free to take it over again. It's touching a lot of core stuff I'm not very familiar with, so I'm not sure how much I'm going to get involved with it.
Comment #38
dagmarAlready fixed here: #1977254: Convert dblog_overview() to a Controller