ID:               39874
 User updated by:  sramage at nucleuslabs dot com
 Reported By:      sramage at nucleuslabs dot com
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: FREEBSD 5
 PHP Version:      4.4.4
 New Comment:

I tried using ftell and it returned the exact same result as gztell.

If ftell returns the _uncompressed_ byte pointer position, wouldn't
that make the gztell function pointless?

Shouldn't one of these functions tell the *actual* file pointer
position?

I was trying to create specific size GZ files using this function as a
measuring device I have found another way that is inefficient but it
works (we're only talking about 10 seconds over 100MB so not a big deal
just wasn't sure about the actual difference between ftell and gztell or
if they just a designed to behave a certain way when they encounter
compressed/uncompressed data). 

hopefully this help with the documentation.
Thanks!


Previous Comments:
------------------------------------------------------------------------

[2006-12-19 15:14:19] [EMAIL PROTECTED]

gzread() and gztell() operate on _uncompressed_ bytes, that should be
mentioned in gztell() docs (already done for gzread()).
Reclassified as docu problem.

------------------------------------------------------------------------

[2006-12-18 18:36:46] sramage at nucleuslabs dot com

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 this bug report at http://bugs.php.net/?id=39874&edit=1

Reply via email to