sivasekar / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

eval font update, eval causes memory issues on simple small documents #74

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What would you like dompdf to do:
Change a part of the code so that dompdf does not eval the font php code.
When generating a pdf with simple html code (few divs, h2 and img tags, no
tables) I was getting a memory error at eval(), limit was 32M.

After change the code to what I propose below it works great, and uses less
memory ( eval = evil ;) ).

Do you have an example:

class.pdf.php line ~2217
-remove 
$tmp = file_get_contents($dir.'php_'.$name.'.afm');

class.pdf.php line ~2220
-remove
eval($tmp);
-add
include_once($dir.'php_'.$name.'.afm');

class.pdf.php line ~2356
-change
file_put_contents($dir . 'php_' . $name . '.afm',  '<?php
$this->fonts[$font]=' . var_export($data,  true)  . ';');

(adding <?php so the php page actually becomes a php page)

Original issue reported on code.google.com by brobot...@gmail.com on 22 Sep 2009 at 12:58

GoogleCodeExporter commented 9 years ago
Thank you for this idea, we made this change recently, but we didn't saw your 
issue report ;) We should really have read you sooner !
It was clearly a memory leak.

Original comment by fabien.menager on 27 Jul 2010 at 8:18

GoogleCodeExporter commented 9 years ago

Original comment by eclecticgeek on 30 May 2013 at 5:15