coppermine-gallery.com/forum

Support => cpg1.6.x Support => cpg1.6 miscellaneous => Topic started by: nukeworker on March 06, 2026, 09:12:16 PM

Title: 1.6.27 error message
Post by: nukeworker on March 06, 2026, 09:12:16 PM
[06-Mar-2026 19:19:17 UTC] PHP Deprecated:  Optional parameter $showYear declared before required parameter $only_future_dates is implicitly treated as a required parameter in /pictures/calendar.php on line 233

This PHP error occurs because of a change in PHP 8.0+ regarding how function parameters are handled. In older versions, you could place an optional parameter (one with a default value) before a required parameter, but this is now deprecated because it's logically inconsistent.

Old
function getMonthHTML($m, $y, $showYear = 1, $only_future_dates) {
New:
function getMonthHTML($m, $y, $showYear = 1, $only_future_dates = false) {
While you are at it, there are a few other spots in this specific file that will likely trigger the same or similar issues in PHP 8.x:

    Line 161 (getMonthView): The call to getMonthHTML here only passes 4 arguments. By adding the = false default above, this line will now work correctly without modification.

    Lines 304–318 (getYearHTML): These lines call getMonthHTML with only 3 arguments (missing the $only_future_dates entirely).

        Current code: $this->getMonthHTML(0 + $this->startMonth, $year, 0)

Need to add the default value to the function definition, then these calls will now automatically use false for the missing 4th argument, and the error will vanish.
Title: Re: 1.6.27 error message
Post by: ron4mac on March 06, 2026, 11:56:39 PM
Thank you ... fixed in soon-to-be-released v1.6.28.