This morning I was greeted by an error saying there was an incorrect date on line 106. The following change appears to work:

	if($month==1) {
		$num_days_prev = cal_days_in_month(CAL_GREGORIAN, 12, $prev_year);
	} else {
		$num_days_prev = cal_days_in_month(CAL_GREGORIAN, $month-1, $year); // orig code
	}
CommentFileSizeAuthor
#11 archive-line-359-error.patch280 bytestetramentis

Comments

stephane bouillet’s picture

same same:

warning: cal_days_in_month() [function.cal-days-in-month]: invalid date. in /homez.59/my_DB_name/www/sites/all/modules/archive/archive.module on line 106.

I've tried to replace line 106 by your code:

  • at first, issue still here :(
  • second, I clic on the link "function.cal-days-in-month", and error desappear... but come back when clic on another node...
Anonymous’s picture

Same issue here but the code appeared to fix the problem.

Thanks.

sietecoyote’s picture

Title: Can't count back a year » works with 5.14
Version: 6.x-1.3 » 5.x-1.4

I used your solution with version 5.14 and fixed the warning of cal_days_in_month,,

I just removed the comment in the original code line because leaving it causes a Parse error;
so, my final code is like this:

if($month==1) {
$num_days_prev = cal_days_in_month(CAL_GREGORIAN, 12, $prev_year);
} else {
$num_days_prev = cal_days_in_month(CAL_GREGORIAN, $month-1, $year); 
}
sietecoyote’s picture

Title: works with 5.14 » Solution to count back a year in 6.x and 5.x

just fixing the forum title to a better search :)

sietecoyote’s picture

Version: 5.x-1.4 » master

just fixing the forum title to a better search :)

TomChiverton’s picture

Same error here on latest 5.x Drupal core and latest version of this module.
Made the change indicated above by hand, and the errors have cleared.

StS’s picture

Status: Active » Reviewed & tested by the community

The fix is also a possible solution to the same problem with drupal 6.8.

mdin617’s picture

A better patch for the 6.x one at least (I don't have 5.x to test with):

// OLD: $num_days_prev = cal_days_in_month(CAL_GREGORIAN, $month-1, $year);
$num_days_prev = cal_days_in_month(CAL_GREGORIAN, $prev_month, $prev_year);

It only requires the one line because the current version of the 6.x branch already works out what last month was and what year it was in and assigns it to the prev_month and prev_year variables.

physiotek’s picture

i tested it on 5.x and it doesn't work for me.(#8)
the other patch is perfect.(#3)
thanks all!

cssdru’s picture

Hello,

I had the same issue but solved now. I tried the mdin617's patch (Drupal 6 too) and it worked perfectly.

Thank you very much!

tetramentis’s picture

StatusFileSize
new280 bytes

same issue here:

cal_days_in_month() [function.cal-days-in-month]: invalid date. in sites/all/modules/archive/archive.module line 359.

PHP version is 5.2.6-5, Drupal core 5.14, archive module 5.x-1.11.

solution #3 by sietecoyote worked fine, patch file is attached.

bismigalis’s picture

This is more correct fix:

$num_days_prev = cal_days_in_month(CAL_GREGORIAN, $prev_month, $prev_year);
tetramentis’s picture

according to #9, this one-liner doesn't work on Drupal 5.

spjsche’s picture

The solution @ #12 did the trick for archive module 6.13

Thanks
Stephen

binki’s picture

Solution #12 made my day!

Archive 6.x-1.3

Drupal 6.15
MySQL database 5.0.77
PHP 5.2.10
Web server Apache

Thanx!

tetramentis’s picture

#8/#12 worked for me as well in 6.14 (upgrading to 6.15 right now, but that shouldn't change anything).

Could someone commit this change to the 6.x branch? That would save lots of time for anyone just starting to use the Archive module on 6.x.

And solution in #3 (with patch in #11) seems to work for the 5.x branch, if anyone still needs that.

spjsche’s picture

+1 for #16

hillaryneaf’s picture

subscribing... please add to next 6.x release

radiobuzzer’s picture

#12 tested on Drupal 6.15. Fully functional.

v8powerage’s picture

Nice module, but doesn't work in January ROFL!

None of the solutions works for me :/

tetramentis’s picture

#8 (#12) still works fine in January with Drupal 6.15, so Shaman - double-check if you did properly apply the fix and cleared the cache.

v8powerage’s picture

It's February soon, so I'll wait till next year, perhaps there'll be some update in this module :D

R.Muilwijk’s picture

Version: master » 5.x-1.x-dev
Status: Reviewed & tested by the community » Needs work

Fixed for the 6.x branch/7.x-branch. If someone wants this fixed in the 5 version please provide a patch.