psliwa / PHPPdf

Pdf and graphic files generator library written in php
http://ohey.pl
MIT License
339 stars 77 forks source link

Node init fails (almost) random #114

Closed Thorry84 closed 8 years ago

Thorry84 commented 8 years ago

Call to a member function saveGS() on null in /vendor/psliwa/php-pdf/lib/PHPPdf/Core/ComplexAttribute/ComplexAttribute.php on line 81 .

This occurs because the preFormat isn't called on a node where it should be. The reason for this is within the Node manager the key in the preFormatInvoked array is the spl_object_hash, but these aren't unique. PHP reuses object hashes, causing the library to fail at seemingly random moments, once PHP reuses a hash for a node previously used for an initialized node, the node doesn't get initialized and fails.

Thorry84 commented 8 years ago

I've added a pull request to fix this problem: https://github.com/psliwa/PHPPdf/pull/113

psliwa commented 8 years ago

Thanks! I will review this PR asap.

psliwa commented 8 years ago

PR has been merged.