Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Joins using 'extra' numeric fields that require 'Views substitutions' are broken after the fix to db_safe() method. Because the fix to db_safe() applies the numeric rule before query substitutions are applied to the whole sql statement, that happens later.
Attached a patch that applies 'Views substitutions' before db_safe() is invoked.
Patch is against 6.x-2.14, though the problem may affect other versions of Views.
Comment | File | Size | Author |
---|---|---|---|
#31 | check.patch | 707 bytes | dawehner |
#26 | 1330716-substitions-2.x_1.patch | 2.18 KB | Tomm-dupe |
#5 | 1330716-substitions-2.x.patch | 2.19 KB | dawehner |
#5 | 1330716-substitions-3.x.patch | 2.38 KB | dawehner |
#2 | 1330716-substitions-2.x.patch | 2.16 KB | dawehner |
Comments
Comment #1
dawehnerIn general this patch makes sense, thanks, but there is a problem, because this could cause quite some hook executions.
What about storing them on the view object.
Comment #2
dawehnerHere is the patch for 2.x
Comment #3
__Sander__ CreditAttribution: __Sander__ commentedThe patch for 2.14 worked for me
the patch for 3.x made the site crash
I mean... I had 2.12
After the security issue tried to update to 3.x rc2, then encountered this bug.
Found this issue, applied the patch and the site stopped working.
Went down to 2.14, applied the patch for 2.14, it worked
Comment #4
dawehnerThanks, will work on the patch later.
Comment #5
dawehnerOkay this time with no bug
Comment #6
quicksketchThanks guys, marking #1331122: Update to views 6.x-2.14 caused all flag related views to stop working. duplicate from the Flag queue.
Comment #7
izmeez CreditAttribution: izmeez commentedThanks, the 2.x.patch in comment #5 works when applied to 6.x-2.14
Status changed to RTBC, hope it's not to soon to change the status.
Comment #8
markus_petrux CreditAttribution: markus_petrux commented@dereine: your patch makes much more sense indeed. Thanks! :)
Comment #9
radiorel CreditAttribution: radiorel commentedThanks for this - I had a view with a relationship set to the user's current flagged nodes which wasn't displaying following the 6.x-2.13 security update, have applied this patch and all is working fine now.
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedpatch 1330716-substitions-3.x.patch works
Comment #11
Honza Pobořil CreditAttribution: Honza Pobořil commented3.x patch works. Could somebody commit it?
Comment #12
dawehnerOkay commited this to 6.x-2.x and 6.x-3.x Thanks for testing the patch!
Comment #13
protoplasm CreditAttribution: protoplasm commentedThank you for this fix. It saved the day.
Comment #14
Honza Pobořil CreditAttribution: Honza Pobořil commentedCould this bug be in the 7.x-3.x branch? I plan to upgrade to D7.
Comment #15
dawehnerNo it's not, this part of the code is totally different.
Comment #16
StephenRobinson CreditAttribution: StephenRobinson commentedsubscribing
Comment #17
lanzs CreditAttribution: lanzs commentedthanks for fix!
Comment #18
towlie CreditAttribution: towlie commentedIs this going to be added to a new version 6.2.15 soon? Can someone upload the fixed file for 6.2.14 please?
Thanks!
Comment #19
robdebones CreditAttribution: robdebones commentedI recently taken over the management of a website and Drupal is a steep learning curve for me. I do not have the coding experience and knowledge and I'm trying to learn fast! Could you please explain to this bewildered chap how to apply the 1330716-substitions-2.x.patch above I'm unsure of exactly what code to put where! I've found the right place in the directory but I'm unsure what to add or replace. If you could please explain what to put where and if I add it or replace the existing code. I appreciate your patience and help with this.
Thanks
Rob
Comment #20
dawehnerPlease read http://drupal.org/node/707484 for more details how to apply a patch.
Comment #21
MrHaroldA CreditAttribution: MrHaroldA commentedWhy isn't this bug marked as 'critical'? I can't apply the security update without destroying most of my sites. :(
Comment #22
zietbukuel CreditAttribution: zietbukuel commentedThis should be included in the release.
Comment #23
quicksketchGeez guys, hold your horses. As @dereine said in #12:
It's already in the next release, but the new version number and archive just isn't created yet. No one wants to have two releases of Views come out with major problems. Just sit tight and update your site next week or whenever the update for 2.15 comes out.
If increasing the "Priority" of the issue makes people feel better, I've done so in accordance with the official Priority levels of issues.
Comment #24
lanzs CreditAttribution: lanzs commentedGetting a error:
Fatal error: Call to a member function substitutions() on a non-object in ~\sites\all\modules\views\includes\handlers.inc on line 1625
Comment #25
Tomm-dupe CreditAttribution: Tomm-dupe commented1330716-substitions-2.x.patch tested with 6.x-2.14.
Two new errors found:
"Fatal error: Call to a member function substitutions() on a non-object in ~\sites\all\modules\contrib\views\includes\handlers.inc on line 1301" when using clicking in node view on taxonomy term and using module Taxonomy Views Integrator to show the result in a view
"An error occurred. .../autocomplete_filter/.../page_1<br />
<b>Fatal error</b>: Call to a member function substitutions() on a non-object in <b>~\sites\all\modules\contrib\views\includes\handlers.inc</b> on line <b>1301</b><br />" when entering something in the text box of autocomplete filter
Maybe that helps fixing the problem in #24
Thanks!
Comment #26
Tomm-dupe CreditAttribution: Tomm-dupe commentedI did something with the patch from #5 in line 11 to solve the problem of #25. That works for me, but I'm not sure what it really does. Maybe someone with more experience in patching views can check it.
Thanks!
Comment #27
brayo4 CreditAttribution: brayo4 commented# 24, if your problem is Node Gallery, I rolled back to Views 6.x-3.0-rc2 and everything works just fine. Something in the update there after............
Comment #28
dawehnerInstead of working around it's more a question, why is $view here not defined.
In general it think it would make more sense to add the $view object via a setter callback when the object is initialized.
Comment #29
trigdog CreditAttribution: trigdog commentedI am also getting this error when using the Taxonomy Views Integrator using Views 6.x-3.x-dev Nov-11- 2011.
Fatal error: Call to a member function substitutions() on a non-object in ~/sites/all/modules/views/includes/handlers.inc on line 1624
Comment #30
dawehnerThat's a bug of taxonomy views integrator, or let's say a bad implemented usage of the views api.
Just created an issue with a patch, without testing the patch, in the tvi issue queue #1339390: Views code doesn't execute pre_execute()
Comment #31
dawehnerWraps the code with a short check
Comment #32
lanzs CreditAttribution: lanzs commentedbrayo4, yeap its with node_gallery, but I need this patch to avoid another error.
I solved it by changing
$replacements = $view->substitutions();
onif($view) $replacements = $view->substitutions();
in views/includes/handlers.inc (line 1625)Comment #33
bcn CreditAttribution: bcn commentedPatch from #31 works on the latest 6.x-3.x-dev release.
Comment #34
trigdog CreditAttribution: trigdog commented@dereine, Thanks for the fast response. #31 solved my problem :)
Comment #35
Anonymous (not verified) CreditAttribution: Anonymous commentedthanks for fixing
Comment #36
dawehnerCommited this patch to 6.x-3.x and 6.x-2.x