Page MenuHomePhorge

PHP 8.1 "strlen(null)" exceptions trying to authenticate via custom OAuth provider
Closed, ResolvedPublic

Description

  1. PHP 8.2.8
  2. As an admin, successfully set up a (custom) OAuth1 provider at http://phorge.localhost/auth/config/view/1/ - in this case https://gitlab.wikimedia.org/repos/phabricator/extensions/-/tree/wmf/stable/src/oauth
  3. As a user, go to http://phorge.localhost/auth/
  4. Select the login button to go to http://phorge.localhost/auth/login/mediawiki:whatever/
[2023-08-04 18:08:10] EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:121]
  #1 <#2> PhutilOAuth1AuthAdapter::newOAuth1Future(string) called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:139]
  #2 <#2> PhutilOAuth1AuthAdapter::getClientRedirectURI() called at [<wmf-ext-misc>/src/oauth/PhutilMediaWikiAuthAdapter.php:100]
  #3 <#2> PhutilMediaWikiAuthAdapter::getClientRedirectURI() called at [<phorge>/applications/auth/provider/PhabricatorOAuth1AuthProvider.php:57]
  #4 <#2> PhabricatorOAuth1AuthProvider::processLoginRequest(PhabricatorAuthLoginController) called at [<phorge>/applications/auth/controller/PhabricatorAuthLoginController.php:42]
  #5 <#2> PhabricatorAuthLoginController::handleRequest(AphrontRequest) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #6 phlog(RuntimeException) called at [<phorge>/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #7 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #8 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/var/www/html/wmfphab/deployment/phabricator/webroot/index.php:35]

Fix that exception; get next exception:

[2023-08-04 18:09:57] EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:125]
  #1 <#2> PhutilOAuth1AuthAdapter::newOAuth1Future(string) called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:139]
  #2 <#2> PhutilOAuth1AuthAdapter::getClientRedirectURI() called at [<wmf-ext-misc>/src/oauth/PhutilMediaWikiAuthAdapter.php:100]
  #3 <#2> PhutilMediaWikiAuthAdapter::getClientRedirectURI() called at [<phorge>/applications/auth/provider/PhabricatorOAuth1AuthProvider.php:57]
  #4 <#2> PhabricatorOAuth1AuthProvider::processLoginRequest(PhabricatorAuthLoginController) called at [<phorge>/applications/auth/controller/PhabricatorAuthLoginController.php:42]
  #5 <#2> PhabricatorAuthLoginController::handleRequest(AphrontRequest) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #6 phlog(RuntimeException) called at [<phorge>/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #7 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #8 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/var/www/html/wmfphab/deployment/phabricator/webroot/index.php:35]

Fix that exception; get next exception in Arcanist due to ($this->tokenSecret) being null for some reason, not too be covered in this ticket / patch:

[2023-08-04 18:10:31] EXCEPTION: (RuntimeException) urlencode(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> urlencode(NULL) called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:232]
  #2 <#2> PhutilOAuth1Future::signString(string) called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:223]
  #3 <#2> PhutilOAuth1Future::sign(array) called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:110]
  #4 <#2> PhutilOAuth1Future::getSignature() called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:133]
  #5 <#2> PhutilOAuth1Future::getProxiedFuture() called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:290]
  #6 <#2> PhutilOAuth1Future::resolvex() called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:144]
  #7 <#2> PhutilOAuth1AuthAdapter::getClientRedirectURI() called at [<wmf-ext-misc>/src/oauth/PhutilMediaWikiAuthAdapter.php:100]
  #8 <#2> PhutilMediaWikiAuthAdapter::getClientRedirectURI() called at [<phorge>/applications/auth/provider/PhabricatorOAuth1AuthProvider.php:57]
  #9 <#2> PhabricatorOAuth1AuthProvider::processLoginRequest(PhabricatorAuthLoginController) called at [<phorge>/applications/auth/controller/PhabricatorAuthLoginController.php:42]
  #10 <#2> PhabricatorAuthLoginController::handleRequest(AphrontRequest) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #11 phlog(RuntimeException) called at [<phorge>/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #12 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #13 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #14 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #15 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/var/www/html/wmfphab/deployment/phabricator/webroot/index.php:35]
[2023-08-04 18:10:31] EXCEPTION: (PhutilAggregateException) Encountered a processing exception, then another exception when trying to build a response for the first exception.
    - RuntimeException: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated
    - RuntimeException: urlencode(): Passing null to parameter #1 ($string) of type string is deprecated at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:316]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#4> urlencode(NULL) called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:232]
  #1 <#4> PhutilOAuth1Future::signString(string) called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:223]
  #2 <#4> PhutilOAuth1Future::sign(array) called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:110]
  #3 <#4> PhutilOAuth1Future::getSignature() called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:133]
  #4 <#4> PhutilOAuth1Future::getProxiedFuture() called at [<arcanist>/src/future/oauth/PhutilOAuth1Future.php:290]
  #5 <#4> PhutilOAuth1Future::resolvex() called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:144]
  #6 <#4> PhutilOAuth1AuthAdapter::getClientRedirectURI() called at [<wmf-ext-misc>/src/oauth/PhutilMediaWikiAuthAdapter.php:100]
  #7 <#4> PhutilMediaWikiAuthAdapter::getClientRedirectURI() called at [<phorge>/applications/auth/provider/PhabricatorOAuth1AuthProvider.php:57]
  #8 <#4> PhabricatorOAuth1AuthProvider::processLoginRequest(PhabricatorAuthLoginController) called at [<phorge>/applications/auth/controller/PhabricatorAuthLoginController.php:42]
  #9 <#4> PhabricatorAuthLoginController::handleRequest(AphrontRequest) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #10 <#3> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #11 <#3> file_exists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1068]
  #12 <#3> Filesystem::pathExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1169]
  #13 <#3> Filesystem::assertExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1020]
  #14 <#3> Filesystem::isDescendant(NULL, string) called at [<phorge>/view/widget/AphrontStackTraceView.php:33]
  #15 <#3> AphrontStackTraceView::render() called at [<phorge>/view/AphrontView.php:222]
  #16 <#3> AphrontView::producePhutilSafeHTML() called at [<phorge>/infrastructure/markup/render.php:115]
  #17 <#3> phutil_escape_html(AphrontStackTraceView) called at [<phorge>/infrastructure/markup/render.php:139]
  #18 <#3> phutil_escape_html(array) called at [<phorge>/infrastructure/markup/render.php:97]
  #19 <#3> phutil_tag(string, array, array) called at [<phorge>/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:62]
  #20 <#3> PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #21 <#3> AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #22 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #23 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/var/www/html/wmfphab/deployment/phabricator/webroot/index.php:35]
  #24 phlog(PhutilAggregateException) called at [<phorge>/aphront/response/AphrontUnhandledExceptionResponse.php:32]
  #25 AphrontUnhandledExceptionResponse::setException(PhutilAggregateException) called at [/var/www/html/wmfphab/deployment/phabricator/webroot/index.php:46]

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.