Drupal 7 和分类广告模块错误
我正在使用分类广告模块测试 drupal 7,但在安装模块后,我遇到了一个无聊的错误:
- 注意:常量 REQUEST_TIME 已在 include_once() 中定义(/var/www/chri/sites/all/modules/ed_classified 的第 34 行) /ed_classified.module)。
当我查看 php 代码时,我无法找到问题,因为如果已经定义了以下函数,则不应定义 REQUEST_TIME...
/*
* 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
}
有什么建议吗?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来 Drupal 6 代码已升级到 Drupal 7,但他们忘记删除它。删除那段代码应该是安全的。请务必在模块的问题队列中提交问题和/或提供补丁,以便其他人可以从您的修复中受益!
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!
该代码的主要问题是它实际上是错误的。 Defined() 接收一个字符串,而不是一个常量。这就是为什么它不能按预期工作。
因此,正如戴夫所说,填写模块的错误报告,这需要针对 6.x(它在那里导致 E_NOTICE)和 7.x 进行修复。
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.
此修复是几周前作为 ed_classified 模块返工的一部分包含的,现在在分支 6.x-3.x 和 7.x-3.x 中
如果您仍然发现问题,请在模块问题队列中报告它们:它比在 SE 上询问会帮助更多的人,并且您可能会得到实际的模块修复而不是本地补丁。
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.