Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.3.3

Bug #8856 Broken error handling in image() function
Submitted: 2006-10-05 09:08 UTC
From: mattias at thorslund dot us Assigned: yunosh
Status: Closed Package: File_PDF (version 0.1.0)
PHP Version: 4.4.0 OS: Linux/Mandriva 2006.0
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 12 + 4 = ?

 
 [2006-10-05 09:08 UTC] mattias at thorslund dot us (Mattias Thorslund)
Description: ------------ I found a problem with how errors are handled in the image() function. If the _parsePNG() call on line 2193 in PDF.php returns an error, the $info object will be an error object, and can therefore not be used as an array a few lines down: //this returns "Cannot use a scalar value as an array" //when $info is a PEAR_Error object $info['i'] = count($this->_images) + 1; One solution might be to immediately check the value returned by _parsePNG(), and immediately return the error: if(PEAR::IsError($info)){ return $info; } Test script: --------------- Call image() and supply for instance a PNG image with an alpha channel. Expected result: ---------------- Would have expected the error raised by _parsePNG() to propagate back as the image() return value? Actual result: -------------- File /var/www/s2a/pear/File/PDF.php, line 2198: Cannot use a scalar value as an array File /var/www/s2a/pear/File/PDF.php, line 2217: Division by zero

Comments

 [2006-10-05 12:02 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!