php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36473 Foreign Images w/getimagesize() crash Apache2
Submitted: 2006-02-21 10:50 UTC Modified: 2010-07-07 10:37 UTC
Votes:6
Avg. Score:4.5 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:2 (50.0%)
From: punkpuke at terraimpetus dot com Assigned: pajoye (profile)
Status: Closed Package: Apache2 related
PHP Version: 4.4.2 OS: Windows XP Pro
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: punkpuke at terraimpetus dot com
New email:
PHP Version: OS:

 

 [2006-02-21 10:50 UTC] punkpuke at terraimpetus dot com
Description:
------------
When accessing foreign URLs with getimagesize(), apache server crashes with:

szAppName : Apache.exe     szAppVer : 2.0.55.0     szModName : php4ts.dll     
szModVer : 4.4.2.2     offset : 000c5fca

---------------------
The only changes made to the PHP.ini file were the enabling/removing the comment in front of the GD2 and the ZIP, DLL extensions.

Server is running as a test environment on localhost.

Reproduce code:
---------------
<?php
getimagesize('images/example.gif');  //Works Fine (Local)
getimagesize('example.jpg'); //Works Fine
//The following crash the Entire Apache server, no matter where they're used
getimagesize('http://example.com/example/example.jpg');//Crashes 
getimagesize('http://example.com/example.jpg'); //Crashes 
getimagesize('http://example.com/example.gif'); //Crashes
@getimagesize('http://example.com/example.gif'); //Crashes
?>

Expected result:
----------------
Apache 2 Servers lags for a slight moment, then crashes 100% of the time that a page using a foreign URL call to getimagesize() is run.


Patches

image (last revision 2011-01-31 08:11 UTC by ishanka_layanthi at yahoo dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-21 13:52 UTC] mike@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Works fine here.
 [2006-02-21 20:04 UTC] punkpuke at terraimpetus dot com
I would love to help, however those instructions aren't detailed enough for me to do anything.  I need to know the exact files I need and where to put them.  I'm sorry, I'm not that smart. :(
 [2006-02-21 23:10 UTC] mike@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-02-24 13:59 UTC] Peter at ibforen dot de
I have had a similar problem with IIS and php.exe:

With external urls getimagesize causes an indefinite loop in that function.

Using the isapi module php4isapi.dll solves the problem.
 [2006-02-27 17:16 UTC] stitched at mindspring dot com
This also happens with Apache 1.3.33 and 2.0.54 consistently with 4.4.2 on Windows 2000.  Will try to get a backtrack but given where and when it's crashing it may not work.

Dave
 [2006-02-27 21:33 UTC] stitched at mindspring dot com
I can confirm that this problem is fixed with 5.1.2.  I didn't see a backtrace version for 4.4.2 so was unable to get one.  But something is certainly broken in 4.4.2.

Dave
 [2006-03-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-03-16 15:03 UTC] jaroslav dot povolny at gmail dot com
I am getting the same error without Apache environment when using function file_get_contents() and file() with http protocol... I think it is connected
 [2006-03-16 15:07 UTC] jaroslav dot povolny at gmail dot com
I have just installed back 4.4.1 version and the bug disappeared. It is definetelly 4.4.2 bug, it is somewhere in file() or file_get_contents(). Platform: Windows XP
 [2006-04-05 02:57 UTC] nospam at fidk dot com
Get the same problem (PHP crashes) with fopen as well as file and file_get_contents.  Under 4.2.2.  Try this code:

<?php
    $host = 'weather.aero';
    $location =   "/dataserver0_9/httpparam?dataSource=airsigmets&requestType=retrieve&format=xml&minLat=25&minLon=-130&maxLat=65&maxLon=-40&hoursBeforeNow=3";


   $pirepUrl = "http://".$host.$location;
   $fd = fopen($pirepUrl, "rb");

   echo("Done");


?>
 [2006-04-05 06:37 UTC] tony2001@php.net
This bug has been fixed in CVS 3 months ago.
 [2010-07-07 08:01 UTC] nooshin dot ha at gmail dot com
I have the same problem! even though there is sentence at the bottom of this page which claims the problem has been solved! I PHP 5.2.8 and Apache 2! as soon as I deactivate the part of code which uses the get_image_size function everything's ok! but if I let it run, Apaches crash and MySQL returns hundreds of Null Sleep State queries because it can not connect to Apache!
I wanna know what PHP & Apache version support the function with out problem?

P.S: unfortunately due to Apache crash, the log file doesn't return any error..
 [2010-07-07 08:18 UTC] nooshin dot ha at gmail dot com
well, I think I solved the problem by myself! we defined a sub domain for our images (e.g images.example.com) and we address the images to the function with this url-base method! I changed it to directory-base like this "/images/"and it works fine!!! however I used linux server ...
 [2010-07-07 10:37 UTC] pajoye@php.net
-Assigned To: +Assigned To: pajoye
 [2010-07-07 10:37 UTC] pajoye@php.net
Open a new bug using the image crashing imagegetsize (provide a link to it). Also please try using the latest PHP or RC before.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC