Bug #61677 [Opn->Csd]: ext\zlib\tests\bug_52944.phpt fails
Edit report at https://bugs.php.net/bug.php?id=61677&edit=1
ID: 61677
Updated by: ab@php.net
Reported by: ab@php.net
Summary: ext\zlib\tests\bug_52944.phpt fails
-Status: Open
+Status: Closed
Type: Bug
Package: Zlib related
Operating System: all
PHP Version: Irrelevant
-Assigned To:
+Assigned To: ab
Block user comment: N
Private report: N
New Comment:
skip this test on windows until zlib dep was upgraded to 1.2.7
Previous Comments:
------------------------------------------------------------------------
[2012-07-13 09:47:46] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=02b8362ec231edb5be2a4ff633ad609c70713131
Log: Fixed bug #61677 ext\zlib\tests\bug_52944.phpt fails
------------------------------------------------------------------------
[2012-05-23 15:19:44] ab@php.net
What happens here is most likely a zlib issue. After a lot of debugging I came up with the snippet
to look what happens if php is completely ommited (just quickly adopted some code from the net):
======================= START SNIPPET ===================================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <zlib.h>
#define CHUNK 0x4000
int main ()
{
const char * file_name = "corrupted.gz";
FILE * file;
z_stream strm = {0};
unsigned char in[CHUNK];
unsigned char out[CHUNK];
int status;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.next_in = in;
strm.avail_in = 0;
strm.next_out = out;
status = inflateInit2(&strm, -15);
if (0 > status) {
fprintf(stderr, "inflateInit2(): %s\n", zError(status));
return 3;
}
file = fopen(file_name, "rb");
if (!file) {
fprintf(stderr, "fopen(): %s\n", strerror(errno));
return 3;
}
while (1) {
int bytes_read;
bytes_read = fread(in, sizeof(char), sizeof(in), file);
if (ferror(file)){
fprintf(stderr, "fread(): %s\n", strerror(errno));
return 3;
}
strm.avail_in = bytes_read;
do {
strm.avail_out = CHUNK;
status = inflate(& strm, Z_NO_FLUSH);
if (0 > status) {
inflateEnd(&strm);
fprintf(stderr, "inflate(): %s\n", zError(status));
return 1;
}
printf("%s", out);
}
while (strm.avail_out == 0);
if (feof(file)) {
inflateEnd(&strm);
break;
}
}
if (fclose(file)) {
fprintf(stderr, "fclose(): %s\n", strerror(errno));
return 3;
}
return 0;
}
======================= END SNIPPET =====================================
I've used the data from the original bug which is still available under http://188.40.74.4/corrupted.gz and then compiled it on
windows
cl inflate.c C:\php-sdk\php53\vc9\x86\deps\lib\zlib_a.lib "C:\Program Files\Microsoft Visual
Studio 10.0\VC\lib\msvcrt.lib" /I C:\php-sdk\php53\vc9\x86\deps\include
and linux
gcc -o inflate inflate.c -lz
The result is pretty matching, the out on windows gives
%Cë
and on linux
inflate(): data error
So PHP.
In both of my tests PHP reports zlib version of 1.2.5 . Despite this we could try to upgrade the
zlib version for PHP on windows and see what happens.
------------------------------------------------------------------------
[2012-04-16 12:11:12] ab@php.net
i've just realized, that the output is different on linux ... the thing needs probably more
investigation
------------------------------------------------------------------------
[2012-04-09 11:24:35] ab@php.net
zlib doesn't fail anymore on the bug 52944, so the test out is adopted
------------------------------------------------------------------------
[2012-04-09 11:23:44] ab@php.net
The following patch has been added/updated:
Patch Name: 61677.diff
Revision: 1333970624
URL: https://bugs.php.net/patch-display.php?bug=61677&patch=61677.diff&revision=1333970624
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61677
--
Edit this bug report at https://bugs.php.net/bug.php?id=61677&edit=1
Thread (6 messages)