PHP define's do not work they way they do in C++. They are not part of a pre-processor, but instead actually evaluate like a function. Thus, the way the code is structured drupal_get_path() is running on every single page. It's better to put this "constant" in a function, and return it's value.

Also the full path to the include is not necessary. I frequently get PHP errors caused by this when using drush. I'm not sure exactly why this happens. But I know the solution is to not use the full path.

PHP Fatal error:  Cannot redeclare template_preprocess_views_view_views_rss() (previously declared in /users/me/Sites/mysite/sites/all/modules/contrib/views_rss/theme/ in /Users/me/Sites/mysite/sites/all/modules/contrib/views_rss/theme/ on line 167
Members fund testing for the Drupal project. Drupal Association Learn more


Snipon’s picture

Version: 7.x-2.0-rc3 » 7.x-2.x-dev
2.44 KB

This basically the same patch for the 7.x-2.x-dev branch since the codebase differs.
I also removed absolute paths since they are not really needed.

maciej.zgadzaj’s picture

Status: Needs review » Needs work

Replacing previous define of VIEWS_RSS_PATH with call to module_load_include() will not change anything in terms of efficiency, as module_load_include() uses drupal_get_path() too, so still it will be run on every page.

Also, perhaps the full path to the include was not necessary, but it is necessary in all other cases, as the module doesn't work anymore after removing it.

maciej.zgadzaj’s picture

Issue summary: View changes
Status: Needs work » Closed (works as designed)

Closing after long time of no activity.

sagannotcarl’s picture

Status: Closed (works as designed) » Needs review
498 bytes

I am experiencing the same problem as the original issue. The existing patch here broke all my 'RSS Feed - Fields' views (missing handler).

Here is another patch that addresses the immediate problem of the php error but without the other items that the maintainer has issues with.