php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64218 Class passes text file as an image
Submitted: 2013-02-15 14:28 UTC Modified: 2013-09-25 07:41 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: reptileblackd at gmail dot com Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: 5.4.11 OS: Linux Ubuntu 12.10
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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: reptileblackd at gmail dot com
New email:
PHP Version: OS:

 

 [2013-02-15 14:28 UTC] reptileblackd at gmail dot com
Description:
------------
Hello, I found propably a bug.

I'm using: Imagick 3.1.0RC2

When I'm trying to create object of class Imagick with file which is not an 
image for example file.exe or file.mwb an exception is throwing and it is OK.

But when I'm trying to pass file.txt, it passes without any exception.

It is also ready to return me width and height of txt file using 
getImageGeometry() method.

It returns me 612 of width and 792 of height.

I expects that will throw an exception, but it isn't



Test script:
---------------
$sPath = '/var/www/phpunit.txt';
try {
   $oImage = new \Imagick($sPath);
}
catch(\Exception $e) {
   var_dump('File is not an image');
   die;
}
if (!$oImage->valid()) {
   var_dump('File is not an image');
   die;
}

$aImage = $oImage->getImageGeometry();
var_dump($aImage);

Expected result:
----------------
string 'File is not an image' (length=20)



Actual result:
--------------
array (size=2)
  'width' => int 612
  'height' => int 792

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-25 07:41 UTC] mkoppanen@php.net
This is purely ImageMagick behaviour 
http://www.imagemagick.org/script/formats.php:

TXT	RW	Raw text file
 [2013-09-25 07:41 UTC] mkoppanen@php.net
-Status: Open +Status: Not a bug
 [2013-09-25 07:41 UTC] mkoppanen@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 11:01:30 2024 UTC