Page MenuHomePhabricator

If HTTP response headers are already sent, don't fiddle with "zlib.output_compression"
ClosedPublic

Authored by epriestley on Apr 3 2020, 7:21 PM.
Tags
None
Referenced Files
F13255538: D21055.diff
Sat, May 25, 5:58 AM
F13239423: D21055.id.diff
Wed, May 22, 2:54 AM
F13235708: D21055.diff
Tue, May 21, 6:16 AM
F13214412: D21055.diff
Fri, May 17, 10:20 AM
F13209946: D21055.id50160.diff
Fri, May 17, 3:01 AM
F13209442: D21055.id50161.diff
Fri, May 17, 12:13 AM
F13208793: D21055.diff
Thu, May 16, 7:30 PM
F13191411: D21055.id50161.diff
Sat, May 11, 8:34 PM
Subscribers
None

Details

Summary

We write some synthetic HTTP responses inside unit tests. Some responses have an indirect side effect of adjusting "zlib.output_compression", but this adjustment fails if headers have already been output. From a CLI context, headers appear to count as already-output after we write anything to stdout:

<?php

echo headers_sent() ? "Y" : "N";
echo "\n";
echo headers_sent() ? "Y" : "N";
echo "\n";

This script prints "N", then "Y".

Recently, the default severity of warnings was increased in libphutil; this has been a long-standing warning but now causes test failures.

This behavior is sort of silly but the whole thing is kind of moot anyway. Just skip it if "headers_sent()" is true.

Test Plan

Ran "arc unit --everything", got clean results.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable