Download & Extend

warning: gmmktime() expects parameter 3...

Project:Drupal core
Version:6.x-dev
Component:aggregator.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)

Issue Summary

I realized a while back that my cron job wasn't running at all. I tried to set up a server cron job and that won't run either (cPanel) So I tried running it manually by entering the url cmtravelathome.com/cron.php this works except I get this error every time:

warning: gmmktime() expects parameter 3 to be long, string given in /home/cmtrav/public_html/modules/aggregator/aggregator.module on line 785

I have looked all over drupal.org and can't seem to find any information on fixing this error - I am hoping that if I can get this error fixed then this will fix the problem with the cron job not running as well.

I welcome any suggestions however, I'm not really a programmer so please be specific in any troubleshooting instructions.

Thanks!
Judi

Comments

#1

Version:5.0» 6.x-dev
Priority:critical» normal

$seconds needs to be set to 0 instead of NULL when it is not included in the timestamp.

#2

My suggest is to use some kind of check before send values to gmmktime() as the W3C date/time format is not very strict:

Like this:

if (empty($hours)) $hours = 0;
if (empty($seconds)) $seconds = 0;

etc.

updated:
There is more interesting way: use (int) instead.
$epoch = gmmktime((int)$hours, (int)$minutes, (int)$seconds, (int)$month, (int)$day, (int)$year);

#3

Status:active» needs review

Attached patch will cast to 0 (integer) all NULLs from parsing W3C date/time format.

AttachmentSizeStatusTest resultOperations
aggregator_module.patch1.08 KBIgnored: Check issue status.NoneNone

#4

Is there any who had tested it?

#5

I tried but can't reproduce.

#6

I wasn't able to reproduce the error either.

@vladimir: Were you able to reproduce the error reported by the original poster???

#7

Status:needs review» postponed (maintainer needs more info)

Changing status.

#8

I think if we use a regexp to parse string we have explicitly cast the matches.

#9

From a few quick tests i found out that $seconds should be $match[7], as $match[6] keeps the ":".
I temporarely added

$seconds = is_numeric($seconds) ? $seconds : $match[7];

before the gmmktime() invocation just to be sure.

#10

subscribing...

#11

Just ran into this issue:

warning: gmmktime() expects parameter 3 to be long, string given in /drupal/modules/aggregator/aggregator.module on line 668.

#12

Just ran into this issue.

warning: gmmktime() expects parameter 3 to be long, string given in /var/www/html/modules/aggregator/aggregator.module on line 666

Note that it's line 666 now. This error occurred when I updated a node with a Feed_Field in it (which depends on Aggregator).