Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Attempting Tutorial) Fatal error: Uncaught Dompdf\Exception: No block-level parent found. Not good. #1704

Closed
ghost opened this issue Apr 2, 2018 · 2 comments
Labels

Comments

@ghost
Copy link

ghost commented Apr 2, 2018

So i am running the tutorial script as in the readme.md and am receiving this error:

Notice: Trying to get property 'size' of non-object in /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.local:5757/build/vendor/dompdf/dompdf/src/Dompdf.php on line 735

Fatal error: Uncaught Dompdf\Exception: No block-level parent found. Not good. in /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.local:5757/build/vendor/dompdf/dompdf/src/Positioner/Inline.php:44 Stack trace: # 0 /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.local:5757/build/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(873): Dompdf\Positioner\Inline->position(Object(Dompdf\FrameDecorator\Inline)) # 1 /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.local:5757/build/vendor/dompdf/dompdf/src/FrameReflower/Inline.php(51): Dompdf\FrameDecorator\AbstractFrameDecorator->position() # 2 /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.local:5757/build/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(894): Dompdf\FrameReflower\Inline->reflow(NULL) # 3 /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.local:5757/build/vendor/dompdf/dompdf/src/FrameReflower/Page.php(141): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow() # 4 /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.co in /Users/devleaf/OneDrive/Work/Devleaf/Development/devleaf.local:5757/build/vendor/dompdf/dompdf/src/Positioner/Inline.php on line 44

I used composer to install the library and my code is as follows:

use Dompdf\Dompdf;
ob_clean();
$pdf = new Dompdf();
$pdf->set_option('isHtml5ParserEnabled', true);
$pdf->loadHtml('Hello World');
$pdf->setPaper('A4', 'landscape');
$pdf->render();
$pdf->stream();
exit('Pdf should run');

I have also tried:
$pdf->loadHtml('<p>Hello World</p>');
which does not lead to any success.

My setup is as follows:

OS: MacOS 10.13.3
Programs: MAMP PRO 4.4.1, Codekit 3.5.2
PHP Version: PHP 7.2.1

Any help would be appreciated. As there is nothing which should stop the tutorial code from working except a bug in the code.

@ghost ghost changed the title Fatal error: Uncaught Dompdf\Exception: No block-level parent found. Not good. (Tutorial) Fatal error: Uncaught Dompdf\Exception: No block-level parent found. Not good. Apr 2, 2018
@ghost ghost changed the title (Tutorial) Fatal error: Uncaught Dompdf\Exception: No block-level parent found. Not good. (Attempting Tutorial) Fatal error: Uncaught Dompdf\Exception: No block-level parent found. Not good. Apr 2, 2018
@bsweeney
Copy link
Member

bsweeney commented Apr 3, 2018

Not sure about the notice, maybe related to #1705?

Which version of dompdf are you using? We were seeing a lot of "block-level parent not found" errors recently and it was due to the version of libxml (#1560). 0.8.2 included a patch against that particular issue.

@ghost
Copy link
Author

ghost commented Apr 3, 2018

Thanks for your reply bsweeney. Yeah the notice shouldn't be anything to worry about, it was more so the fatal error.

Currently running v0.8.2 of dompdf with the following requirement versions:
sabberworm/php-css-parser: 8.1.0
phenx/php-svg-lib: v0.3
phnnx/php-font-lib: 0.5.1
and as stated previously php v7.2.1. Tried doing a bit of digging around but can't seem to notice any issues with conflict.

Thanks in advance for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant