php.net |  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
 [2007-03-25 01:42 UTC] programmer at serbiansite dot com
Description:
------------
getimagesize returns Array for php files if you add GIF at beginning of the file.

Reproduce code:
---------------
phpgif.php

GIF
<?php 
echo "PHP CODE";
?>


test.php
<?
$image = "phpgif.php";
$image_size = getimagesize($image);
echo"<pre>";
print_r($image_size);
echo"</pre>";
?>


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

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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-25 14:21 UTC] iliaa@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

As long as the file contains a header resembling that of a GIF image 
getimagesize() function will report it as such.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:25 2019 UTC