dompdf/php-svg-lib

ErrorException: Undefined property: Svg\Style::$href

rhorbas opened this issue ยท 6 comments

I have an SVG image embedded in a PDF, which now throws an exception after updating to PHP 8.3 and Laravel 10.

File:
src/Svg/Style.php:โ€‰146

if (
    \array_key_exists("font-family", $styles)
    && (
        \strtolower(\substr($this->href, 0, 7)) === "phar://"
        || ($this->document->allowExternalReferences === false && \strtolower(\substr($this->href, 0, 5)) !== "data:")
    )
) {
    unset($style["font-family"]);
}

(After commenting out this block, the PDF is working again.)

I was just reviewing this code yesterday and realized that it's ... not correct. Working on a fix and should have it out soon.

Hello,

Is safe to remove this (src/Svg/Style.php:146) until a fix is published?

if ( \array_key_exists("font-family", $styles) && ( \strtolower(\substr($this->href, 0, 7)) === "phar://" || ($this->document->allowExternalReferences === false && \strtolower(\substr($this->href, 0, 5)) !== "data:") ) ) { unset($styles["font-family"]); }

I just added the change to master branch. If you have a moment to test and it looks good I'll go ahead and publish the next release.

I'm sorry but found another issue:

Message: 'Undefined variable $from', Trace: '#0 /app/sources/vendor/phenx/php-svg-lib/src/Svg/Tag/Image.php(61):

Don't be sorry. I'm the one who should be sorry, that was just sloppy. Should be fixed now.

I'm sorry because you're the one who is volunteering to do this work. I'm just a consumer. :D

Anyways. It works!

Thank you!