Greetings,

We have found that when argument is specified in the beginning of the URL (like $arg/video/favorites) it is processed incorrectly and doesn't work.

The reason is how views_get_url($view, $args) function performs replacement. To fix this we propose to change:

      if ($where && $where = strpos($url, '$arg')) {

to

      if ($where && (($where = strpos($url, '$arg')) !== false)) {

This fixed the problem for us. May be you will find more graceful solution.
Thank you.

Comments

rmpel’s picture

There are more issues in regard to $arg as first url-part.
All four issues involve the fact that the coder has failed to realise that 0 == false returns true, while false is expected, in other words; where $arg at the first position (a.k.a. strpos == 0) should be seen as 'url has it' (a.k.a. if statements 'true' condition code) the == operator evaluates the condition as false, therefore executing the wrong code.

Solution;

use === instead of ==
use !== instead of !=

and the fix Ardas provided; use !== false after an in-line assignment.

The patchfile included with this post is based on version 5.x-1.4-2rc1 (CVS ID Tag: $Id: views.module,v 1.189 2006/12/20 06:13:49 merlinofchaos Exp $)

A patch for the latest version (5.x-1.6 , $Id: views.module,v 1.166.2.43 2007/07/14 18:54:16 merlinofchaos Exp $) is included also, implementing two (2) times the patch suggested by Ardas only. The other issues seem not to apply as the caching of argument-urls has been removed (appearantly).

catch’s picture

Status: Active » Needs review

this is a patch.

catch’s picture

Status: Needs review » Closed (duplicate)
rmpel’s picture

Status: Closed (duplicate) » Reviewed & tested by the community

If you mark a topic as duplicate, please mark the newer topic about the same issue as duplicate. Mostly so because the topic you indicated only partly patches the problem.

esmerel’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

At this time, only security fixes will be made to the 5.x version of Views.