I got the above error when upgrading to the current version of the archive module. It's caused by the php install on our server that's way old (4.3.11). Anyway, I'm not sure if it's appropriate to include this in the main tree, but here's a patch that fixes the error in case you encounter it (by creating the function if it doesn't exist yet).

This patch seems to work on systems that have the cal function, and systems that don't.

Comments

travisdst’s picture

The patch works perfectly! Thank you.

To apply the patch, just make the "archive.module" source code at line 103 match what the "archive.patch" source code says by copying and pasting, then removing the preceding plus signs (+).

I'm novice so I can't explain it well technically, but I hope that helps!

Raven2000’s picture

Drupal 6.6 & Archive 6.x-1.3
add block Archive
Fatal error: Call to undefined function cal_days_in_month() in /usr/home/user/drupal/modules/archive/archive.module on line 106
=(

sodafox’s picture

Oooh Thank you! Patch worked Great! I'm pulling my hair out, this was the easiest fix so far! I can't believe Drupal is so hard to set up with what you need!

jonne.freebase’s picture

Keep in mind that the best solution is still to upgrade php to something more recent. There's no real reason to stick with php 4 nowadays (we finally upgraded our server to php5 too, and none of the sites that ran on it broke, even the ones that were way old).

To apply the patch, either use the unix patch tool, or paste any line that starts with a + into the file around line 356, and remove the + before each line.

Also, it's useless to ask questions to the original poster on drupal.org, because this forum thing has no e-mail notification, which makes it hard to follow up on your stuff.

Ralf Saalmueller’s picture

I just run into the error and it looks like it's not everytime about the php version. The system has php version 5.2.6 with corresponding apache-mod-php and with archive-5.x.1-11 run into the error:
[Tue May 05 14:11:15 2009] [error] [client x.x.x.x] PHP Fatal error: Call to undefined function cal_days_in_month() in /srv/www/xxx/drupal/modules/archive/archive.module on line 359

But you should check if the php5-calendar extension is installed on your system ;-)

Read on: http://www.php.net/manual/de/calendar.installation.php

That made my day!

memiek’s picture

Version: 5.x-1.11 » 6.x-1.3

I'm using the latest version of Archive (6.x-1.3), the latest Drupal version (6.15) and PHP 5.2.8 with calendar support enabled and am still getting this error message. Adding the lines form the patch only created other errors so I've deleted them again.
Any idea how to solve the problem?

R.Muilwijk’s picture

Category: support » bug
R.Muilwijk’s picture

Version: 6.x-1.3 » 5.x-1.x-dev
Status: Needs review » Needs work

Committed to the 6.x and 7.x branch. If someone wants it backported to drupal 5 please provide a patch.

baku3393’s picture

Hi,

I found same issue on Archive 7.x-1.3-alpha1 on Drupal 7.x beta2.
PHP version is 5.3.3.

Error message in apache httpd error_log is below :

" PHP Fatal error: Call to undefined function cal_days_in_month() in /var/www/html/blog/sites/all/modules/archive/archive.module on line 97, referer: http://hogehogehoge.fuga/html/blog/admin/structure/block "

And applying the patch, it is fixed.
(And + define('CAL_GREGORIAN', 0); )

I wish this issue on D7 will be fixed next release. :-)

Regards.

R.Muilwijk’s picture

I'll look into it.

stufke’s picture

Here's a simpler patch for 7.x-1.3-alpha1 that removes the dependency altogether (the built-in date() function has support for this as well)

stufke’s picture

Sorry, it should be strtotime, not time. Here's a proper patch