php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27490 system function produces garbage with zlib.output_copmression
Submitted: 2004-03-04 04:11 UTC Modified: 2004-03-10 19:52 UTC
From: mortoray at ecircle-ag dot com Assigned:
Status: Closed Package: Zlib related
PHP Version: 4.3.4 OS: Windows NT 5.0 build 219
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mortoray at ecircle-ag dot com
New email:
PHP Version: OS:

 

 [2004-03-04 04:11 UTC] mortoray at ecircle-ag dot com
Description:
------------
Using the zlib.output_compression=On and the function system() produces garbage output to the browser.  Specifically, it does a gzip encoding but omits the "Content-Encoding: gzip" header.

Using "passthru" instead of "system" works as intended.

Turning off compression and using "system" works as intended.

Reproduce code:
---------------
<?php
    //in php.ini set zlib.output_compression=On
    //replace system with passthru to make it work
    system( "cmd.exe /c dir" );
?>

Expected result:
----------------
Either system() should somehow turn off the zlib compression or its output should be compressed properly and the proper headers should be set.

--TCP Flow with passthru()--
GET /dir.php HTTP/1.0
Host: qatest.ecircle.de:8080
Accept: text/*, image/jpeg, image/png, image/*, */*
Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5
Accept-Encoding: x-gzip, x-deflate, gzip, deflate, identity
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.1; Linux; en_US, en)

HTTP/1.1 200 OK
Date: Thu, 04 Mar 2004 09:12:41 GMT
Server: Apache/2.0.45 (Win32) PHP/4.3.4
X-Powered-By: PHP/4.3.4
Content-Encoding: gzip
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1

...........S=O.0..+.?...X.J.-..dAbb`...kk5q...e..sm.
m"q.....{.C.....5....c...1,!..b
....}.MYb.p{..Ks.....x...._x.....2....5..!......5..I.5..._..........?.."a\.B........|......j....i...Iw..*....i.........[yE..
.-.~N.W.'.Xmy....).........7V.n.,sE.....ye....r.I||...c..4...?f...Y.....gW....h!..h.....);?.v...O.:H.A1...U6.^..6......z.......d..g...5..nz.M.XWaM..o%.......>..7
..5.c....y....6.K.aB......f..p.
......`...
...


Actual result:
--------------
--TCP Flow with system()--

GET /dir.php HTTP/1.0
Host: qatest.ecircle.de:8080
Accept: text/*, image/jpeg, image/png, image/*, */*
Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5
Accept-Encoding: x-gzip, x-deflate, gzip, deflate, identity
Accept-Language: en
Cache-control: no-cache
Pragma: no-cache
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.1; Linux; en_US, en)

HTTP/1.1 200 OK
Date: Thu, 04 Mar 2004 09:13:45 GMT
Server: Apache/2.0.45 (Win32) PHP/4.3.4
X-Powered-By: PHP/4.3.4
Connection: close
Content-Type: text/html; charset=ISO-8859-1

...........S.n.0..#..{..X.....J.\*..CO\...E..........B"un.ggggc...Ma..hA.x.........+.r.nUO..2.!..U..F...".'.o...h.....$...:.9.L..u`q...$.
@.Pxp.s....W..3.*|...*B...t.)H..,S.....vK..*.J..A.gYn..T.$L.=...8..Q.....I{......7X.]A..)M,..g3<.=^_0.uZZ..^.........#..M..L.wPL....).N.V.!;..A....l!o.(Q....)k3.O.....u.5.. ..i.O....M.$N.q.....K4	>.@6.......M..t.....=...|....{...P.0.......>......6...	%.78....n.~..........C
...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-05 18:52 UTC] derick@php.net
Does it work if you set the header yourself with:
header('Content-Encoding: gzip');

?

regards,
Derick
 [2004-03-05 20:37 UTC] scottmacvicar at ntlworld dot com
Duplicate of http://bugs.php.net/bug.php?id=27424

In the case of apache2 sapi_flush sends any pending headers and prevents any further headers being sent unlike Apache 1.

Call to sapi_flush is within php_Exec on line 247 in ext/standard/exec.c
 [2004-03-07 22:24 UTC] scottmacvicar at ntlworld dot com
http://bugs.php.net/bug.php?id=27424 has been fixed and i tested the reproduce code which is now working as expected.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC