Page MenuHomePhorge

Make phorge compatible with PHP 8.1
Open, Needs TriagePublic

Description

Currently phorge is incompatible with PHP 8.1.

Revisions and Commits

Event Timeline

After making lots of changes in my clone to suppress deprecation warnings, I am stuck at the following error.
[Wed Dec 01 16:06:24.853494 2021] [proxy_fcgi:error] [pid 2472770:tid 139879417599744] [client <REDACTED>] AH01071: Got error 'PHP message: [2021-12-01 16:06:24] EXCEPTION: (Exception) Bad getter call: getPreferences at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1620]
PHP message: arcanist(head=master, ref.master=c53bb21bbd3e), phabricator(head=master, ref.master=4448a93a4067), testwiki-ext-misc(head=master, ref.master=c12e85d3a97a)
PHP message: #0 <#2> LiskDAO::call(string, array) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1598]
PHP message: #1 <#2> LiskDAO::call(string, array) called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:446]
PHP message: #2 <#2> PhabricatorUser::loadGlobalSettings() called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:377]
PHP message: #3 <#2> PhabricatorUser::getUserSetting(string) called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:428]
PHP message: #4 <#2> PhabricatorUser::getTranslation() called at [<phabricator>/src/applications/auth/engine/PhabricatorAuthSessionEngine.php:1127]
PHP message: #5 <#2> PhabricatorAuthSessionEngine::willServeRequestForUser(PhabricatorUser) called at [<phabricator>/src/applications/base/controller/PhabricatorController.php:109]
PHP message: #6 <#2> PhabricatorController::willBeginExecution() called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:271]
PHP message: #7 phlog(Exception) called at [<phabricator>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
PHP message: #8 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, Exception) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
PHP message: #9 AphrontApplicationConfiguration::handleThrowable(Exception) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
PHP message: #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
PHP message Log, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
PHP messaghutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]PHP messaguration.php:204]
PHP messaglicationConfiguration.php:204]PHP messagont/configuration/AphrontApplicationConfiguration.php:204]
PHP messagd at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
PHP message aphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
PHP message: #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:35]PHP message: [2021-12-01 16:06:24] EXCEPTION: (PhutilAggregateException) Encountered a processing exception, then another exception when trying to build a response for the first exception.\n - Exception: Bad setter call: setUserPHID\n - Exception: Bad getter call: getPreferences at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:316]
PHP message: arcanist(head=master, ref.master=c53bb21bbd3e), phabricator(head=master, ref.master=4448a93a4067), testwiki-ext-misc(head=master, ref.master=c12e85d3a97a)
PHP message: #0 <#4> LiskDAO::call(string, array) called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:446]
PHP message: #1 <#4> PhabricatorUser::loadGlobalSettings() called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:377]
PHP message: #2 <#4> PhabricatorUser::getUserSetting(string) called at [<phabricator>/src/applications/people/storage/PhabricatorUser.php:428]
PHP message: #3 <#4> PhabricatorUser::getTranslation() called at [<phabricator>/src/applications/auth/engine/PhabricatorAuthSessionEngine.php:1127]
PHP message: #4 <#4> PhabricatorAuthSessionEngine::willServeRequestForUser(PhabricatorUser) called at [<phabricator>/src/applications/base/controller/PhabricatorController.php:109]
PHP message: #5 <#4> PhabricatorController::willBeginExecution() called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:271]
PHP message: #6 <#3> LiskDAO::call(string, array) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1598]
PHP message: #7 <#3> LiskDAO::__call(string, array) called at [<phabricator>/src/applications/search/engine/PhabricatorApplicationSearchEngine.php:666]PHP message: #8 <#3> PhabricatorApplicationSearchEngine::getBuiltinQueries() called at [<phabricator>/src/applications/search/engine/PhabricatorApplicationSearchEngine.php:500]
PHP message: #9 <#3> PhabricatorApplicationSearchEngine::loadAllNamedQueries() called at [<phabricator>/src/applications/search/engine/PhabricatorApplicationSearchEngine.php:537]
PHP message: #10 <#3> PhabricatorApplicationSearchEngine::loadEnabledNamedQueries() called at [<phabricator>/src/view/page/menu/PhabricatorMainMenuSearchView.php:157]
PHP message: #11 <#3> PhabricatorMainMenuSearchView::getGlobalSearchScopeItems(PhabricatorUser, PhabricatorFlagsApplication) called at [<phabricator>/src/view/page/menu/PhabricatorMainMenuSearchView.php:205]
PHP message: #12 <#3> PhabricatorMainMenuSearchView::buildModeSelector(string, string) called at [<phabricator>/src/view/page/menu/PhabricatorMainMenuSearchView.php:89]
PHP message: #13 <#3> javelin_tag(string, array, array) called at [<phabricator>/src/view/phui/PHUIListItemView.php:426]
PHP message: #14 <#3> phutil_tag(string, array, array) called at [<phabricator>/src/infrastructure/javelin/markup.php:70]
PHP message: #15 <#3> javelin_tag(string, array, array) called at [<phabricator>/src/view/AphrontTagView.php:161]
PHP message: #16 <#3> AphrontTagView::render() called at [<phabricator>/src/view/AphrontView.php:222]
PHP message: #17 <#3> AphrontView::producePhutilSafeHTML() called at [<phabricator>/src/infrastructure/markup/render.php:111]
PHP message: #18 <#3> phutil_escape_html(PHUIListView) called at [<phabricator>/src/infrastructure/markup/render.php:135]
PHP message: #19 <#3> phutil_escape_html(array) called at [<phabricator>/src/infrastructure/markup/render.php:97]
PHP message: #20 <#3> phutil_tag(string, array, array) called at [<phabricator>/src/view/page/menu/PhabricatorMainMenuView.php:168]
PHP message: #21 <#3> PhabricatorMainMenuView::render() called at [<phabricator>/src/view/page/PhabricatorStandardPageView.php:374]
PHP message: #22 <#3> PhabricatorStandardPageView::willRenderPage() called at [<phabricator>/src/view/page/AphrontPageView.php:46]
PHP message: #23 <#3> AphrontPageView::render() called at [<phabricator>/src/applications/base/controller/PhabricatorController.php:286]
PHP message: #24 <#3> PhabricatorController::willSendResponse(AphrontDialogResponse) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:300]
PHP message: #25 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
PHP message: #26 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:35]
PHP message: #27 phlog(PhutilAggregateException) called at [<phabricator>/src/aphront/response/AphrontUnhandledExceptionResponse.php:32]
PHP message: #28 AphrontUnhandledExceptionResponse::setException(PhutilAggregateException) called at [<phabricator>/webroot/index.php:46]'

I'm not sure what the issue is here. arc lint isn't coming up with any errors.

I noticed this recently too. These PHP 8 updates have been frustrating because it breaks Arcanist for users as well...

We might need to review the changes to see what all might be causing issues
https://www.php.net/releases/8.1/en.php
https://php.watch/versions/8.1

I have submitted patches to fix most of the issues. The following issues still remain.

  • When loading Phorge, there is a bar across the top that says unexpected output "X"
  • XHpast cannot compile due to an "x" somehow being inserted at the beginning of the version number, which makes it not match the expected version number. This also seems to happen with my changes in place on PHP 8.0 and 7.4.
  • When creating a new install, when loading Phorge, it says it cannot find the database (yes, no database exists). However a new install should instruct you to run ./bin/storage upgrade. When running that, it says that we are in read only, and thus need to use --force. Using --force results in an error saying the database couldn't be found. --force shouldn't be needed, and it shouldn't fail.

I wasn't able to fix these issues, I wasn't completely sure what was wrong. My changes are mostly suppressing deprecation warnings. In total 1000+ files were modified.

Wouldn't a massive changeset like this greatly increase difficulty of performing future merges of upstream (secure.phabricator.com)?

Wouldn't a massive changeset like this greatly increase difficulty of performing future merges of upstream (secure.phabricator.com)?

Yeah possibly, and upstream isn't very likely to add support for PHP 8.1.

There were more upstream changes made a week ago, https://secure.phabricator.com/w/changelog/2021.49/, that included improved PHP8 compatibility...

There were more upstream changes made a week ago, https://secure.phabricator.com/w/changelog/2021.49/, that included improved PHP8 compatibility...

That'll be changes for PHP 8.0 compatibility, but that's not the same as PHP 8.1 compatibility.

Evan just posted some comments regarding 8.1 compatibility (as well as building PHP binary to ship with Arcanist, for Mac systems at least)
https://secure.phabricator.com/T13588#256390

With a diff to address some 8.1 issues in Arcanist
https://secure.phabricator.com/D21740

The fixes mentioned there would take a long time to implement, as things like strlen() are used in 900+ files.