Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception in Client ID handling of PhabricatorOAuthServerTokenController
ClosedPublic

Authored by aklapper on Thu, May 29, 10:08.

Details

Summary

strlen() was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

strlen(): Passing null to parameter #1 ($string) of type string is deprecated
#0 PhabricatorOAuthServerTokenController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]

See Q182

Test Plan

Read the code. strlen is used to get the length of an existing string and not to check for emptiness of a string. There is no string length comparison in the existing code.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ooooor this, feel free to do whatever bro

src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php
24–25

or this

This revision is now accepted and ready to land.Thu, May 29, 14:04

Thanks! Oh true I was forget the default fallback option... ah well I guess not a huge difference performance wise plus null feels cleaner to me :)