سؤال

i'm testing drupal 7 with the Classified Ads module but after module installation, i got a boring error :

  • Notice: Constant REQUEST_TIME already defined in include_once() (line 34 of /var/www/chri/sites/all/modules/ed_classified/ed_classified.module).

When i took a look at the php code i wasn't able to find the problem cause the following function is not supposed to define REQUEST_TIME if already defined...

/*
 * Drupal 7 provides REQUEST_TIME as time of start of request. This
 * is more efficient than using time() every time. Adopted here.
 */
if (!defined(REQUEST_TIME)) {
  define('REQUEST_TIME', time()); //LINE 34
}

Any suggestion ?

هل كانت مفيدة؟

المحلول

Looks like Drupal 6 code that was up-ported to Drupal 7, but they forgot to remove it. Should be safe just to remove that chunk of code. Be sure to also file an issue in the module's issue queue and/or provide a patch so everyone else can benefit from your fix!

نصائح أخرى

The main problem of that code is that it is actually wrong. defined() recieves a string, not a constant. That's why it doesn't work as expected.

So, as Dave said, fill a bug report for the module, this needs to be fixed for 6.x (it is causing a E_NOTICE there) and 7.x.

This fix was included some weeks ago as part of the rework of ed_classified module, now in branches 6.x-3.x and 7.x-3.x

If you still find issues with it, please report them on the module issue queue: it will help more people than asking on S.E., and you may get an actual module fix instead of a local patch.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top