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.

Comments

dawehner’s picture

StatusFileSize
new2.35 KB

In 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.

dawehner’s picture

StatusFileSize
new2.16 KB

Here is the patch for 2.x

__Sander__’s picture

Status:Needs work» Needs review

The 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

dawehner’s picture

Status:Needs review» Needs work

Thanks, will work on the patch later.

dawehner’s picture

StatusFileSize
new2.38 KB
new2.19 KB

Okay this time with no bug

quicksketch’s picture

izmeez’s picture

Status:Needs review» Reviewed & tested by the community

Thanks, 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.

markus_petrux’s picture

@dereine: your patch makes much more sense indeed. Thanks! :)

radiorel’s picture

Thanks 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.

Anonymous’s picture

patch 1330716-substitions-3.x.patch works

Bobík’s picture

3.x patch works. Could somebody commit it?

dawehner’s picture

Status:Reviewed & tested by the community» Fixed

Okay commited this to 6.x-2.x and 6.x-3.x Thanks for testing the patch!

protoplasm’s picture

Thank you for this fix. It saved the day.

Bobík’s picture

Could this bug be in the 7.x-3.x branch? I plan to upgrade to D7.

dawehner’s picture

No it's not, this part of the code is totally different.

SangersDrupalDude’s picture

subscribing

lanzs’s picture

thanks for fix!

towlie’s picture

Is 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!

robdebones’s picture

Version:6.x-2.x-dev» 6.x-2.14

I 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

dawehner’s picture

Please read http://drupal.org/node/707484 for more details how to apply a patch.

MrHaroldA’s picture

Why isn't this bug marked as 'critical'? I can't apply the security update without destroying most of my sites. :(

zietbukuel’s picture

This should be included in the release.

quicksketch’s picture

Priority:Normal» Major

Geez guys, hold your horses. As @dereine said in #12:

Okay commited this to 6.x-2.x and 6.x-3.x Thanks for testing the patch!

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.

lanzs’s picture

Version:6.x-2.14» 6.x-3.0-rc2
Status:Fixed» Needs review

Getting 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

Tomm-dupe’s picture

1330716-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!

Tomm-dupe’s picture

StatusFileSize
new2.18 KB

I 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!

brayo4’s picture

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

dawehner’s picture

Instead 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.

trigdog’s picture

I 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

dawehner’s picture

That'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()

dawehner’s picture

StatusFileSize
new707 bytes

Wraps the code with a short check

lanzs’s picture

brayo4, yeap its with node_gallery, but I need this patch to avoid another error.
I solved it by changing $replacements = $view->substitutions(); on if($view) $replacements = $view->substitutions(); in views/includes/handlers.inc (line 1625)

bcn’s picture

Patch from #31 works on the latest 6.x-3.x-dev release.

trigdog’s picture

@dereine, Thanks for the fast response. #31 solved my problem :)

Anonymous’s picture

thanks for fixing

dawehner’s picture

Status:Needs review» Fixed

Commited this patch to 6.x-3.x and 6.x-2.x

Status:Fixed» Closed (fixed)

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