Page MenuHomePhorge

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

Authored by aklapper on Aug 26 2024, 21:40.
Tags
None
Referenced Files
F2894382: D25811.1737229749.diff
Fri, Jan 17, 19:49
F2874847: D25811.1736964698.diff
Tue, Jan 14, 18:11
F2874769: D25811.1736962362.diff
Tue, Jan 14, 17:32
F2871145: D25811.1736838307.diff
Mon, Jan 13, 07:05
F2870461: D25811.1736797343.diff
Sun, Jan 12, 19:42
F2869433: D25811.1736705181.diff
Sat, Jan 11, 18:06
F2869430: D25811.1736704914.diff
Sat, Jan 11, 18:01
F2866398: D25811.1736628690.diff
Fri, Jan 10, 20:51

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