Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi we're using drupal 6 (actully pressflow 6).
In browscap_cron() is use of REQUEST_TIME, from what I can tell this is only defined in drupal 7 not drupal 6. As a result this is causing my cron.php to error. Is there somewhere else this is defined so that the module can use it? Or is this just a result of a backport from drupal 7 where something got missed?
Comment | File | Size | Author |
---|---|---|---|
#6 | browscap-Revert_to_using_time-1711674-6.patch | 2.44 KB | Drave Robber |
#3 | define-undefined-constant-1711674-3.patch | 550 bytes | Devin Carlson |
#1 | browscap-define-request-time.patch | 638 bytes | ChrisConolly |
Comments
Comment #1
ChrisConolly CreditAttribution: ChrisConolly commentedI've moved this to 6.x-1.2 as thats what I meant to tag it with to start, also, as I'm pretty sure this a bug so I've created the following patch.
Be gentle with me, this is the first patch I've posted on Drupal.org, just let me know if something with it is wrong
Comment #2
Devin Carlson CreditAttribution: Devin Carlson commentedNice catch. Thanks for the bug report and patch! As you mentioned, the undefined constant is the result of code backporting from Browscap 7.x.
After reviewing your patch, I've noticed a few issues:
There should be a space between "//" and "Drupal", "definde" is misspelled and there is trailing whitespace.
There should be a space between "if" and "(!" and a space between "'))" and "{".
$_SERVER['REQUEST_TIME']
is only available in PHP 5.1.0 and Drupal 6 must support PHP 4.4.0.A few other tips when contributing (much appreciated) patches:
[short-description]-[issue-number]-[comment-number].patch
.Comment #3
Devin Carlson CreditAttribution: Devin Carlson commentedAttached is a modified version of the patch in #1 which:
time()
instead of$_SERVER['REQUEST_TIME']
as$_SERVER['REQUEST_TIME']
has only been available since PHP 5.1.0 and Drupal 6 supports PHP 4.x (4.4.0 or higher).Comment #4
Devin Carlson CreditAttribution: Devin Carlson commentedCommitted #3 to 6.x-1.x.
Comment #6
Drave Robber CreditAttribution: Drave Robber commentedThere are two problems with this approach:
browscap.module
is not available inbrowscap.install
; hence,browscap_imported
variable is not set correctly upon initial install (to reproduce, install Browscap on a fresh D6 and peek intovariable
table; not that it breaks anything, but it's wrong anyway);REQUEST_TIME
in D7 was to extract some performance gain from avoiding multiple calls totime()
in a single page request; however, if we are defining it ourselves and using only once per page request, and nobody/nothing else is using it, then we gain nothing from the whole affair.On the other hand, some D6 contributed modules (e.g., Acquia Search) do define and use
REQUEST_TIME
; still, there's maybe p≈0.01 chance of 'meeting' another module that does that.Suggested action: stop tinkering and revert to the good ol'
time()
. :)Patch to that effect attached.
Comment #7
Devin Carlson CreditAttribution: Devin Carlson commented#6 sounds fine to me. Committed and pushed to 6.x-1.x.