php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50001 gzseek don't working
Submitted: 2009-10-26 15:45 UTC Modified: 2009-10-29 20:35 UTC
From: onzi at ustrem dot org Assigned: srinatar (profile)
Status: Not a bug Package: Zlib related
PHP Version: 5.2.11 OS: AIX 6.1
Private report: No CVE-ID: None
 [2009-10-26 15:45 UTC] onzi at ustrem dot org
Description:
------------
OSlevel 6100-02-03-0909
xlc 10.1.0.0

I run ./sapi/cli/php ext/zlib/tests/gzseek_basic.phpt

gzopen opens file but gzseek seems to not working.



Reproduce code:
---------------
<?php
$f = dirname(__FILE__)."/004.txt.gz";
$h = gzopen($f, 'r');
var_dump($h);

echo "move to the 50th byte\n";
var_dump(gzseek($h,50));
echo "tell=".gztell($h)."\n";
//read the next 10
var_dump(gzread($h, 10));

echo "\nmove forward to the 100th byte\n";
var_dump(gzseek( $h, 100 ) );
echo "tell=".gztell($h)."\n";
//read the next 10
var_dump(gzread($h, 10));

echo "\nmove backward to the 20th byte\n";
var_dump(gzseek( $h, 20 ) );
echo "tell=".gztell($h)."\n";
//read the next 10
var_dump(gzread($h, 10));
gzclose($h);
?>


Expected result:
----------------
resource(5) of type (stream)
move to the 50th byte
int(-1)
tell=
string(0) ""

move forward to the 100th byte
int(-1)
tell=
string(0) ""

move backward to the 20th byte
int(-1)
tell=
string(0) ""


Actual result:
--------------
move to the 50th byte
int(0)
tell=50
string(10) " high abov"

move forward to the 100th byte
int(0)
tell=100
string(10) "Destiny wh"

move backward to the 20th byte
int(0)
tell=20
string(10) "hrough fee"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-26 15:48 UTC] onzi at ustrem dot org
Read "Expected Result" as "Actual Result"

Sorry
 [2009-10-26 22:46 UTC] jani@php.net
Exactly what is the zlib version in your system you linked PHP with?
 [2009-10-27 01:28 UTC] srinatar@php.net
long story short, by any chance , your PHP compile flags include -D_FILE_OFFSET_BITS=64 option ? if yes, then the below mentioned error will happen ?
 [2009-10-27 07:55 UTC] onzi at ustrem dot org
I use for PHP (--with-zlib-dir=/opt/freeware/lib)
zlib-1.2.3-5
zlib-devel-1.2.3-5
from here: http://gnome.bullfreeware.com/aixtoolbox/RPMS/ppc/zlib/


My env
OBJECT_MODE=32
CC=cc_r
CFLAGS=-O2
 [2009-10-29 20:35 UTC] srinatar@php.net
you are better off compiling your own zlib for this platform. the zlib rpm that you downloaded does not bundle zlib header within and i am not sure, which version of zlib header your php build is using.

this issue typically happens when the underlying dependent library (which in this case is zlib) compiled with different options (like largefiles enabled etc) while php which is using this underlying library is being compiled with a different option. 

there is no php bug here. compiling php and zlib on this platform works fine. 

feel free to reopen this bug, if recompiling doesnt help.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 03:01:29 2024 UTC