• This plugin no longer functions correctly in PHP 8 due to changes in the min and max functions. If you are able (or are willing) to update the code, you can edit the wp-gpx-maps-util.php file and wrap the problem area in code that checks that the $_ele, $_dist, and $_time arrays exist before applying the functions.

    The original code (starting at line 379) is

            $points->maxEle      = max( $_ele );
            $points->minEle      = min( $_ele );
            $points->totalLength = max( $_dist );
            $points->maxTime     = max( $_time );
            $points->minTime     = min( $_time );

    This is the updated code

            if (is_array($_ele) && count($_ele) > 0) {
                $points->maxEle      = max( $_ele );
                $points->minEle      = min( $_ele );                
            }
            if (is_array($_dist) && count($_dist) > 0) {
                $points->totalLength = max( $_dist );
            }
            if (is_array($_time) && count($_time) > 0) {
                $points->maxTime     = max( $_time );
                $points->minTime     = min( $_time );
            }

    Hopefully the original dev will create a new PHP 8 compatible version soon.

  • The topic ‘Patch for PHP 8 error’ is closed to new replies.