• cristianuibar

    (@cristianuibar)


    Hello team,

    I have this error for your module while on PHP 8. Please fix it on your end for the next update.

    Error Level: E_ERROR
    
    Message: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in /home/client/webapps/client/web/app/plugins/samedaycourier-shipping/classes/samedaycourier-sameday-class.php:677
    
    Stack trace:
    
    #0 /home/client/webapps/client/web/app/plugins/samedaycourier-shipping/classes/samedaycourier-sameday-class.php(677): round()
    
    #1 /home/client/webapps/client/web/app/plugins/samedaycourier-shipping/samedaycourier-shipping.php(561): Sameday->addNewParcel()
    
    #2 /home/client/webapps/client/web/wp/wp-includes/class-wp-hook.php(308): {closure}()
    
    #3 /home/client/webapps/client/web/wp/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    
    #4 /home/client/webapps/client/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action()
    
    #5 /home/client/webapps/client/web/wp/wp-admin/admin-post.php(85): do_action()
    
    #6 {main}
    
    thrown
    
    File: /home/client/webapps/client/web/app/plugins/samedaycourier-shipping/classes/samedaycourier-sameday-class.php
    
    Line: 677
    
    Request: /wp/wp-admin/admin-post.php
Viewing 1 replies (of 1 total)
  • Thread Starter cristianuibar

    (@cristianuibar)

    Update upon further investigation, it might be related to how float inputs are sanitized, not 100% sure.

    To clarify a bit, this error shows up when adding new parcels.

    Maybe the problem is here:

    public static function sanitizeInputs(array $inputs): array
    
        {
    
            $data = [];
    
            foreach ($inputs as $key => $input) {
    
                if (is_int($input) || is_bool($input)) {
    
                    $data[$key] = $input;
    
                }
    
                if (is_string($input)) {
    
                    $data[$key] = self::sanitizeInput($input);
    
                }
    
            }
    
            return $data;
    
        }
Viewing 1 replies (of 1 total)

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