#21847 [NEW]: php core dumps whilst retrieving images from url

From: Date: Thu, 23 Jan 2003 19:02:30 +0000
Subject: #21847 [NEW]: php core dumps whilst retrieving images from url
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31081@lists.php.net to get a copy of this message
From: steveh@brendata.co.uk Operating system: linux-2.4.20 PHP version: 4.3.0 PHP Bug Type: Reproducible crash Bug description: php core dumps whilst retrieving images from url When running the following code php core dumps. <? // Read the draper txt file $fp=fopen("draper.txt","r"); $good=fopen("draper_good.txt","w"); $bad=fopen("draper_bad.txt","w"); while(!feof($fp)) { $fields=split(",",fgets($fp)); $url="http://www.drapertools.com/draper/images/details/".trim($fields[1])."_".trim($fields[2]).".jpg"; $outfile="draper_images/draper_".trim($fields[1])."_".trim($fields[2]).".jpg"; print("opening $url\n"); ob_flush(); if($urlfp=fopen($url,"rb")) { print("Outputing to $outfile\n"); if($imagefp=fopen($outfile,"wb")) { print($url." -> ".$outfile."\n"); ob_flush(); fputs($good,$url." -> ".$outfile."\n"); $size=0; while(!feof($urlfp)) { $block=fread($urlfp,4096); fputs($imagefp,$block); $size+=4096; print($url." -> ".$outfile." : $size\n"); }; fclose($imagefp); }; fclose($urlfp); } else { fputs($bad,$url."\n"); }; }; fclose($fp); fclose($good); fclose($bad); ?> The input file is a comma delimited list, we are interested in the filename which we then retrieve from the site (you can find the names by going to the site or by downloading the text file from the site). Just recompiled with debug, here is the backtrace: #0 0x08153650 in php_hostconnect (host=0x82ef62c "www.drapertools.com", port=80, socktype=1, timeout=0x0) at /usr/src/php-4.3.0/main/network.c:435 #1 0x08153900 in _php_stream_sock_open_host (host=0x82ef62c "www.drapertools.com", port=80, socktype=1, timeout=0x0, persistent_id=0x0) at /usr/src/php-4.3.0/main/network.c:619 #2 0x0811a497 in php_stream_url_wrap_http (wrapper=0x82491f0, path=0x82ed5c4 "http://www.drapertools.com/draper/images/details/002_770-SA.jpg", mode=0x82e97cc "rb", options=4, opened_path=0x0, context=0x0) at /usr/src/php-4.3.0/ext/standard/http_fopen_wrapper.c:121 #3 0x08152d2c in _php_stream_open_wrapper_ex (path=0x82ed5c4 "http://www.drapertools.com/draper/images/details/002_770-SA.jpg", mode=0x82e97cc "rb", options=12, opened_path=0x0, context=0x0) at /usr/src/php-4.3.0/main/streams.c:2378 #4 0x080e915a in php_if_fopen (ht=2, return_value=0x82ee5ac, this_ptr=0x0, return_value_used=1) at /usr/src/php-4.3.0/ext/standard/file.c:1094 #5 0x404f78f0 in zend_oe () from /usr/local/Zend/lib/ZendOptimizer.so #6 0x404f43a0 in zend_oe () from /usr/local/Zend/lib/ZendOptimizer.so #7 0x0816f14c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/php-4.3.0/Zend/zend.c:864 #8 0x08148909 in php_execute_script (primary_file=0xbffffb40) at /usr/src/php-4.3.0/main/main.c:1573 #9 0x08190f48 in main (argc=2, argv=0xbffffbe4) at /usr/src/php-4.3.0/sapi/cli/php_cli.c:746 #10 0x40342657 in __libc_start_main (main=0x81905c8 <main>, argc=2, ubp_av=0xbffffbe4, init=0x806fe60 <_init>, fini=0x8196790 <_fini>, rtld_fini=0x4000dcd4 <_dl_fini>, stack_end=0xbffffbdc) at ../sysdeps/generic/libc-start.c:129 -- Edit bug report at http://bugs.php.net/?id=21847&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21847&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21847&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21847&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21847&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21847&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=21847&r=support Expected behavior: http://bugs.php.net/fix.php?id=21847&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=21847&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=21847&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21847&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21847&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21847&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21847&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=21847&r=gnused

« previous php.bugs (#31081) next »