jkoo7yeha / dompdf

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

command line mode CSS bug: background-image #43

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi!  I hope this is the correct place to report this problem.  I've searched 
the issues here and the 
discussion group, but I haven't found this problem mentioned.
Thanks for an excellent PDF creator!
-Tim

What steps will reproduce the problem?
1.  In your css, explicitly set {background-image: none;} for any element
2.  Inside your php script, use the dompdf class directly.  Specifically, the 
script will hang on 
$dompdf->render();
3.  call your php script from the command line:
~# php -f /path/to/script/myscript.php

What is the expected output? What do you see instead?
I expect no errors to output, and the dompdf object to successfully call the 
render() function.
Instead, the following Fatal Error occurs:

PHP Fatal error:  Uncaught exception 'DOMPDF_Exception' with message 'Unknown 
image type: 
/path/to/script/none.' in /path/to/script/dompdf/include/image_cache.cls.php:81
Stack trace:
#0 /path/to/script/dompdf/include/abstract_renderer.cls.php(105): 
Image_Cache::resolve_url('/path/to/script/', NULL, '', '')
#1 /path/to/script/dompdf/include/block_renderer.cls.php(62): Abstract_Renderer-
>_background_image('/path/to/script/', 8, 8.04, 596, 100.464, Object(Style))
#2 /path/to/script/dompdf/include/renderer.cls.php(180): Block_Renderer-
>render(Object(Block_Frame_Decorator))
#3 /path/to/script/dompdf/include/renderer.cls.php(91): 
Renderer->_render_frame('block', 
Object(Block_Frame_Decorator))
#4 /path/to/script/ in /path/to/script/dompdf/include/image_cache.cls.php on 
line 81

It looks to me as if dompdf is taking the 'none' after 'background-image:' 
literally, and trying to 
find a local image called 'none'.  Of course, there is no such image, and 
dompdf crashes.

What version of the product are you using? On what operating system?
Version: 0.5.1
OS: Mac OS X Server 10.4.11

Please provide any additional information below.
This error does no occur if the php script is available to the web and called 
via a browser, only 
when called directly in command line mode.

Original issue reported on code.google.com by timothy....@gmail.com on 21 Jul 2009 at 8:41

GoogleCodeExporter commented 8 years ago
This sounds like a possible bug, so this would be the appropriate place to post 
it.

I am unable to reproduce the problem. I have tried both an inline styles and a 
style definition in the head of the 
document.

Can you provide some sample code? Also, do you know which version of PHP you 
have on your system?

Original comment by eclecticgeek on 22 Jul 2009 at 3:23

GoogleCodeExporter commented 8 years ago
...Well, that will teach me to be lazy and develop as su.  And on outdated 
systems (php version is 5.2.4).

I did some more testing on some other boxes, and this only crops up when the 
the *current working 
directory* is owned by root, and only when php is <5.2.8.  So, admittedly, it's 
a pretty narrow bug.

Anyhow, I've added a sample php file that has potential to cause the crash.

Here are all the conditions I've found to reproduce the bug:

1: {background-image: none} in css
2: current working directory owned by root.  The actual php script can live 
anywhere.
3: Either OS X 10.4 or PHP version 5.2.4.  I could not reproduce the crash on 
my 10.5 system (with both PHP 
5.2.8 and 5.3.0), so I'm not sure if OS X or PHP was the culprit.

Original comment by timothy....@gmail.com on 22 Jul 2009 at 5:50

GoogleCodeExporter commented 8 years ago

Original comment by timothy....@gmail.com on 22 Jul 2009 at 5:56

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the update. We'll check into it to make sure it's not a bug that 
could crop up in other circumstances.

Original comment by eclecticgeek on 23 Jul 2009 at 1:46

GoogleCodeExporter commented 8 years ago
Thanks!  In the meantime, I've gotten around it for now by streamlining the css 
so it doesn't need 'background-
image' in the first place.

Original comment by timothy....@gmail.com on 23 Jul 2009 at 11:24

GoogleCodeExporter commented 8 years ago

Original comment by eclecticgeek on 24 May 2013 at 3:00