From: vdv at bitrixsoft dot com Operating system: Any PHP version: 5.1.4 PHP Bug Type: *General Issues Bug description: GetImageSize function can not determine size of Compressed Flash files (CWS)
Description: ------------ GetImageSize function can not determine size of Compressed Flash files (CWS). Same as here: http://bugs.php.net/bug.php?id=36542&edit=2 http://bugs.php.net/bug.php?id=34338&edit=2 This function still can not determine size and dimensions of the compressed Flash movies untill the Zlib library is compiled statically. But it can be quite easily done with manual decompressing file and reading its header. So it need to be fixed in general case because of the Flash format popularity. Reproduce code: --------------- It can be reproduced with simple script that loads compressed Flash files and matches their sizes. Expected result: ---------------- Here is quick solution based on some tips from your bug descriptions. function swf_decompress($buffer) { if (function_exists('gzuncompress') && substr($buffer, 0, 3) == "CWS" && ord(substr($buffer, 3, 1)) >= 6) { $output = 'F'; $output .= substr ($buffer, 1, 7); $output .= gzuncompress (substr ($buffer, 8)); return ($output); } else return ($buffer); } $tmpFilePath=$arFile."tmp"; $out=fopen($tmpFilePath, "w"); $in=fopen($arFile, "r"); fwrite($out,swf_decompress(fread($in, filesize($arFile)))); fclose($in); fclose($out); $arImageSize = getimagesize($tmpFilePath); unlink($tmpFilePath); Actual result: -------------- Function returns false or error instead of actual size. Interesting that this bug was added here in the year 2002 and it still can be reproduced easily. Do you have some special version that can not be downloaded by others? :) -- Edit bug report at http://bugs.php.net/?id=37643&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37643&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37643&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37643&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37643&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37643&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37643&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37643&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37643&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37643&r=support Expected behavior: http://bugs.php.net/fix.php?id=37643&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37643&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37643&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37643&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37643&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37643&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37643&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37643&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37643&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37643&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37643&r=mysqlcfg