Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cal_days_in_month shim signature is different than PHP which leads to type conversion issue and wrong results #14

Closed
fredericgboutin-yapla opened this issue May 30, 2022 · 2 comments

Comments

@fredericgboutin-yapla
Copy link

fredericgboutin-yapla commented May 30, 2022

 function cal_days_in_month($calendar_id, $month, $year)

VERSUS

cal_days_in_month(int $calendar, int $month, int $year): int

Source: https://www.php.net/manual/en/function.cal-days-in-month.php

So when you call, for example:

cal_days_in_month(CAL_GREGORIAN, '04', '2022');

It returns 28 even though it should return 30.

@fisharebest
Copy link
Owner

Thanks for reporting this.

We cannot add type-hints as we must support PHP 5.3.

But we can cast the parameters to integers, which will fix the issue.

@fisharebest
Copy link
Owner

I have just tagged a 2.6.0 release, which is now available from packagist:

https://packagist.org/packages/fisharebest/ext-calendar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants