Page MenuHomePhorge

PHP Deprecation warnings in STDERR can make arc fail
Open, Needs TriagePublic

Description

Upgrading to PHP 8.4 blocked rendering Phorge in my browsers (see https://we.phorge.it/D25887#26909) and using arc diff (see https://we.phorge.it/D25887#26924) due to plain text deprecation warnings prefixing output in a blob expected to be valid JSON.

After fixing that by applying the two patches in T15989, PHP deprecation warnings still blocked using arc diff due to ending up in STDERR. I don't think that's expected:

Screenshot From 2025-05-09 11-30-51.png (1×1 px, 219 KB)

Screenshot From 2025-05-09 11-32-36.png (1×960 px, 195 KB)

Event Timeline

Reverting rARC29575b4f91876bf0a95739eba50f792e2aa78c0c and rP6619fef2ff977ea81092b970e58abbb33e78f644 makes Phorge throw errors again:
Firefox says This page is in Quirks Mode. Page layout may be impacted.,
Chromium says net::ERR_CONTENT_DECODING_FAILED 200 (OK)),
both because the deprecation warning is added before the usual HTML header created by AphrontPageView, as curl shows:

[acko@foo phorge (master *$|u=)]$ curl 'http://phorge.localhost'
<br />
<b>Deprecated</b>:  Constant E_STRICT is deprecated in <b>/var/www/html/phorge/phorge/support/startup/PhabricatorStartup.php</b> on line <b>391</b><br />
<!DOCTYPE html><html data-developer-mode="1"><head><meta charset="UTF-8" /><title>Home</title><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes" /><link rel="mask-icon" color="#3D4B67" [...]

We don't end up calling PhutilErrorHandler::handleError() or PhutilErrorLog::onError() or PhutilSystem::writeStderr() here.

And for the records, reverting rARCd343be59269a03d6345c80bc0b56414031dcabd8 makes no difference, still the same issue.

So maybe the current situation is... expected, given that we error_reporting(E_ALL) and do not error_reporting(E_ALL ^ E_DEPRECATED) in PhabricatorStartup?