Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception in PhutilOAuth1Future
ClosedPublic

Authored by aklapper on Aug 26 2024, 21:40.

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.

ERROR 8192: urlencode(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/arcanist/src/future/oauth/PhutilOAuth1Future.php:232]

Closes T15929

Test Plan

Run arcanist/bin/arc unit --everything on a PHP >= 8.1 system.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

speck added inline comments.
src/future/oauth/PhutilOAuth1Future.php
235

Does key need initialized to an empty string first? Otherwise what happens when it’s uninitialized and hits this case?

Initialize key as an empty string as proposed by speck

This revision is now accepted and ready to land.Sep 16 2024, 13:02