|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40912 getImagesize returns Array for php files
Submitted: 2007-03-25 01:42 UTC Modified: 2007-03-25 14:21 UTC
From: programmer at serbiansite dot com Assigned:
Status: Not a bug Package: GetImageSize related
PHP Version: 5.2.1 OS: Windows + Linux
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:
Bug Type:
From: programmer at serbiansite dot com
New email:
PHP Version: OS:


 [2007-03-25 01:42 UTC] programmer at serbiansite dot com
getimagesize returns Array for php files if you add GIF at beginning of the file.

Reproduce code:

echo "PHP CODE";

$image = "phpgif.php";
$image_size = getimagesize($image);

Expected result:
Nothing. Because phpgif.php is not a picture.

Actual result:
    [0] => 28735
    [1] => 28776
    [2] => 1
    [3] => width="28735" height="28776"
    [channels] => 3
    [mime] => image/gif


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-25 14:21 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

As long as the file contains a header resembling that of a GIF image 
getimagesize() function will report it as such.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Feb 21 09:01:26 2020 UTC