I'm running PHP 5.1.4. I'm getting this constantly in the Drupal 4.7.2 logs:

mktime() expects parameter 4 to be long, string given in /modules/week/week.module on line 123.

CommentFileSizeAuthor
#1 week_php5.patch605 bytesPrometheus6

Comments

Prometheus6’s picture

Assigned: Unassigned » Prometheus6
StatusFileSize
new605 bytes

Do you know how to patch files?

I'm running the same php version on my production sites now and I'm not getting such a message. On the other hand, if I were I'd just typecast the variables, which would do no harm.

I'd rather not fix what I don't see as broken, but I'm willing to give you a patch. If you don't have patching skills, look for line 152

$query = _weekly_contentQuery(arg(1), arg(2), arg(3), $week_rev_pagesort);

...and replace it with this.

$query = _weekly_contentQuery((int) arg(1), (int) arg(2), (int) arg(3), $week_rev_pagesort);

If it all goes well, I'll update the distribution.

slimandslam’s picture

I have skills. I don't understand your fix, though. The error seems to say that you're passing a string as argument #4, but it expects a long int. So why are you casting arguments 1,2, and 3 as ints??

Prometheus6’s picture

The actual error (which, again, I don't see the error) occurs inside _weekly_contentQuery().

There are two calls to mktime(). If you look, you'll see the first call passes strings to parameter 4 AND 5 AND 6. The second call, where the error occured, passes strings to parameter 4 and 6.

To build the query that populates the block I'm pulling in arguments from the URL. Those default to strings. PHP4 didn't care...PHP5 does (which, incidentally, I think is a very good thing, and I've shifted my development environment over to PHP5 so this sort of thing will stop eventually).

So I'm casting the strings as integers when I pass them into _weekly_contentQuery(). This is something that should address your problem without impacting anything or anyone else.

jw867’s picture

I had the same problem, but the casting resolved it. I would commit the patch.

Prometheus6’s picture

Okay, I just needed a tiebreaker.

slimandslam’s picture

Ok. I see your point. Thanks.

Prometheus6’s picture

Status: Active » Closed (fixed)