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
F15600614: D21055.diff
Tue, May 13, 6:47 PM
Unknown Object (File)
Sat, May 3, 9:46 AM
Unknown Object (File)
Wed, Apr 30, 9:57 AM
Unknown Object (File)
Apr 3 2025, 12:05 AM
Unknown Object (File)
Apr 1 2025, 11:34 AM
Unknown Object (File)
Mar 31 2025, 7:26 PM
Unknown Object (File)
Mar 18 2025, 5:56 AM
Unknown Object (File)
Mar 13 2025, 1:09 AM
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
Branch
iniset
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 23979
Build 33001: Run Core Tests
Build 33000: arc lint + arc unit