laravel-dompdf icon indicating copy to clipboard operation
laravel-dompdf copied to clipboard

TypeError round(): Argument #1 ($num) must be of type int|float, string given

Open taryono opened this issue 3 years ago • 4 comments

Can I report it as a problem on dompdf I found it in line 3304 vendor\dompdf\dompdf\src\Css\Style.php

when I change

function set_z_index($val)
    {
        $this->_props["z_index"] = $val;
        $this->_props_computed["z_index"] = null;
        $this->_prop_cache["z_index"] = null;

        if (round($val) != $val && $val !== "auto") {
            return;
        }

        $this->_props_computed["z_index"] = $val;
    }

to

function set_z_index($val)
    {
        $this->_props["z_index"] = $val;
        $this->_props_computed["z_index"] = null;
        $this->_prop_cache["z_index"] = null;

        if($val !== "auto"){ 
            if (round($val) != $val) {
                return;
            }
        }

        $this->_props_computed["z_index"] = $val;
    }

error gone and running well, I'm using "php": "^7.3|^8.0", // actualy my php version is 8.0.13 "barryvdh/laravel-dompdf": "0.8.7", "laravel/framework": "^8.12",

running on local APP_ENV=local

taryono avatar Aug 08 '22 06:08 taryono

How did you replicate this?

SachinBahukhandi avatar Aug 10 '22 08:08 SachinBahukhandi

This is only a wrapper, that issue must be on dompdf/dompdf

angeljqv avatar Aug 11 '22 13:08 angeljqv

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

stale[bot] avatar Nov 02 '22 05:11 stale[bot]

thanks is already working, it is necessary to change the vendor\dompdf\dompdf\src\Css\Style.php

function set_z_index($val) { $this->_props["z_index"] = $val; $this->_props_computed["z_index"] = null; $this->_prop_cache["z_index"] = null;

    if (round($val) != $val && $val !== "auto") {
        return;
    }

    $this->_props_computed["z_index"] = $val;
}

TO

function set_z_index($val) { $this->_props["z_index"] = $val; $this->_props_computed["z_index"] = null; $this->_prop_cache["z_index"] = null;

    if($val !== "auto"){ 
        if (round($val) != $val) {
            return;
        }
    }

    $this->_props_computed["z_index"] = $val;
}

mnguila avatar Jul 06 '23 15:07 mnguila