Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a Workboard Column
ClosedPublic

Authored by aklapper on May 9 2023, 13:31.

Details

Summary

On a Workboard without any "Group by <something>", when moving a Task from a Column
to another, in PHP 8.1 there was a crash caused by a null passed to strlen().

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.

Closes T15373

Test Plan

Applied this change and afterwards dragging a Task card to another Column succeeded,
with or without a "Group by <something>" query.

Diff Detail

Repository
rP Phorge
Branch
arcpatch-D25207
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 384
Build 384: arc lint + arc unit

Unit TestsFailed

TimeTest
578 msPhabricatorProjectCoreTestCase::testAncestorMembers
EXCEPTION (RuntimeException): Implicit conversion from float 76.50000000000001 to int loses precision #0 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(192): PhutilErrorHandler::handleError(8192, '...', '...', 192) #1 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(148): PhabricatorFilesComposeAvatarBuiltinFile::rgba2gd(Array)
320 msPhabricatorProjectCoreTestCase::testColumnExtendedPolicies
EXCEPTION (RuntimeException): Implicit conversion from float 76.50000000000001 to int loses precision #0 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(192): PhutilErrorHandler::handleError(8192, '...', '...', 192) #1 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(148): PhabricatorFilesComposeAvatarBuiltinFile::rgba2gd(Array)
413 msPhabricatorProjectCoreTestCase::testEditProject
EXCEPTION (RuntimeException): Implicit conversion from float 76.50000000000001 to int loses precision #0 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(192): PhutilErrorHandler::handleError(8192, '...', '...', 192) #1 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(148): PhabricatorFilesComposeAvatarBuiltinFile::rgba2gd(Array)
425 msPhabricatorProjectCoreTestCase::testIsViewerMemberOrWatcher
EXCEPTION (RuntimeException): Implicit conversion from float 76.50000000000001 to int loses precision #0 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(192): PhutilErrorHandler::handleError(8192, '...', '...', 192) #1 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(148): PhabricatorFilesComposeAvatarBuiltinFile::rgba2gd(Array)
336 msPhabricatorProjectCoreTestCase::testJoinLeaveProject
EXCEPTION (RuntimeException): Implicit conversion from float 76.50000000000001 to int loses precision #0 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(192): PhutilErrorHandler::handleError(8192, '...', '...', 192) #1 /var/www/phorge/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php(148): PhabricatorFilesComposeAvatarBuiltinFile::rgba2gd(Array)
View Full Test Results (8 Failed · 22 Passed)

Event Timeline

aklapper requested review of this revision.May 9 2023, 13:31

Tested locally, with and without "Group By <something>"

Hoping to be useful I expand the test plan, and I add a small inline documentation

Thanks again

sgtm

src/applications/project/controller/PhabricatorProjectMoveController.php
31

✅ I verified that the above line is just null or a string

The function phutil_nonempty_string() will report any alien type, and that is OK.

This revision is now accepted and ready to land.May 9 2023, 16:29

add minor inline documentation

valerio.bozzolan retitled this revision from Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a workboard column to Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a Workboard Column.May 9 2023, 16:37
valerio.bozzolan edited the summary of this revision. (Show Details)
valerio.bozzolan edited the test plan for this revision. (Show Details)
This revision was landed with ongoing or failed builds.May 9 2023, 16:37
This revision was automatically updated to reflect the committed changes.

WHOA I hijacked your description just one millisecond before your land it seems