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.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | views.module.5.x-1.4-2rc1.arg-first.patch | 1.35 KB | rmpel |
| #1 | views.module.5.x-1.6.arg-first.patch | 751 bytes | rmpel |
Comments
Comment #1
rmpel commentedThere 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 == falsereturnstrue, whilefalseis 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).Comment #2
catchthis is a patch.
Comment #3
catchhttp://drupal.org/node/193508#comment-692387
Comment #4
rmpel commentedIf 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.
Comment #5
esmerel commentedAt this time, only security fixes will be made to the 5.x version of Views.