From: sramage at nucleuslabs dot com Operating system: FREEBSD 5 PHP version: 4.4.4 PHP Bug Type: *Compression related Bug description: gztell returns incorrect file pointer number
Description: ------------ The GZTELL function returns the gz file pointer as the uncompressed data byte position not the real file pointer location when writing to a file. I am not sure if this is a bug or just the way it is. but it doesn't really make sense so I am reporting it. The example is very simple and clear. just use any text file that is 2 MB or bigger in length to recreate this bug We use the recommened php ini with the following changes: memory_limit = 32M error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR upload_max_filesize = 10Mb session.cookie_lifetime = 0 session.cookie_path = / session.gc_probability = 1 session.gc_divisor = 1 session.gc_maxlifetime = 3600 session.entropy_length = 16 session.entropy_file = /dev/urandom modules: './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--disable-all' '--with-regex=php' '--with-pcre-regex' '--with-pear' '--enable-ftp' '--with-openssl=/usr/local/ssl' '--enable-ftp' '--with-mysql=/usr/local/mysql' '--enable-overload' '--enable-session' '--enable-xml' '--with-zlib=yes' '--with-apxs=/usr/local/apache/bin/apxs' '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php' '--enable-mbstring=all' '--enable-track-vars' '--enable-force-cgi-redirect' '--with-gettext' '--with-pspell' Reproduce code: --------------- <? //Example: //some_file.sql plain text file - filesize = 2,048,000 bytes $text_fp=fopen('some_file.sql','r'); $gz_fp=gzopen('some_file.sql.gz','wb9'); while(!feof($text_fp)){ gzwrite($gz_fp,fread($text_fp,655360)); } fclose($text_fp); echo "gztell = ".gztell($gz_fp)."<BR>\n"; gzclose($gz_fp); echo "filesize = ".filesize('some_file.sql.gz')."<BR>\n"; ?> Expected result: ---------------- gztell = 249264 filesize = 249264 (or something closer to the actual file pointer position in the gz file) Actual result: -------------- gztell = 2048000 filesize = 249264 -- Edit bug report at http://bugs.php.net/?id=39874&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39874&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39874&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39874&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39874&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39874&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39874&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39874&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39874&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39874&r=support Expected behavior: http://bugs.php.net/fix.php?id=39874&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39874&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39874&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39874&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39874&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39874&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39874&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39874&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39874&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39874&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39874&r=mysqlcfg