• Resolved mitchellem

    (@mitchellem)


    Hello,

    We have received a warning on the single team page:

    Warning: mktime() expects parameter 4 to be int, string given in /…/wp-content/plugins/sportspress/modules/sportspress-birthdays.php on line 220

    PHP version -7.4
    SportsPress version – Version 2.7.8

    line 220:
    $age = ( date( ‘md’, date( ‘U’, mktime( 0, 0, 0, $date[0], $date[1], $date[2] ) ) ) > date(‘md’)

    we solved the problem with replacing it with this line:
    $age = ( date( ‘md’, date( ‘U’, mktime( 0, 0, 0, (int) $date[0], $date[1], $date[2] ) ) ) > date(‘md’)

    Could you please check it and make the corresponding changes in the plugin files? Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Savvas

    (@savvasha)

    Hi @mitchellem ,

    But why $date[0] was not an integer in the first place?

    Thanks,
    Savvas

    Thread Starter mitchellem

    (@mitchellem)

    Sorry not sure what you mean by that. We downloaded the SportsPress plugin and didn’t modify any files before the warning appeared.

    Plugin Contributor Savvas

    (@savvasha)

    What I was trying to say is that the line 220:
    $age = ( date( ‘md’, date( ‘U’, mktime( 0, 0, 0, $date[0], $date[1], $date[2] ) ) ) > date(‘md’) it converts the date of birh of a player (i.e. 1/1/1983) to Age (i.e. 38). If for some reason the date of birth is not set correctly, then there will be warnings as the above.

    Did you identify the issue to a single player? What if you modify his/her Date of Birth?

    Thanks,
    Savvas

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Warning: mktime() expects parameter 4 to be int’ is closed to new replies.