php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13258 pdf_place_image dies when image file is not accessible
Submitted: 2001-09-12 01:07 UTC Modified: 2001-10-08 13:23 UTC
From: rob at rsee dot net Assigned:
Status: Not a bug Package: PDF related
PHP Version: 4.0.6 OS: Linux 2.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rob at rsee dot net
New email:
PHP Version: OS:

 

 [2001-09-12 01:07 UTC] rob at rsee dot net
The following code causes a script to silently die on the call to pdf_place_image when the file in pdf_open_image_file is not accessible (exists but file permissions deny access).

$image=pdf_open_image_file($pdf,"png","/usr/local/apache/htdocs/images/timesheet.png");
pdf_place_image($pdf, $image, 1, 1,.48);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-08 13:23 UTC] rjs@php.net
you should use something like:

if (!$image) {
    die("Couldn't open image ".$imagefile);
}

to check whether the image was existing, otherwise PDFlib will throw an exception when you use the invalid image handle afterwards.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC