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

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.

StatusFileSize
new2.16 KB

Here is the patch for 2.x

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

Status:Needs review» Needs work

Thanks, will work on the patch later.

StatusFileSize
new2.38 KB
new2.19 KB

Okay this time with no bug

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.

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

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.

patch 1330716-substitions-3.x.patch works

3.x patch works. Could somebody commit it?

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!

Thank you for this fix. It saved the day.

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

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

subscribing

thanks for fix!

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!

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

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

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

This should be included in the release.

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.

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

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!

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!

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

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.

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

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

StatusFileSize
new707 bytes

Wraps the code with a short check

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)

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

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

thanks for fixing

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.