Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception for "/bin/bulk export --query --format" without parameter
ClosedPublic

Authored by aklapper on Apr 16 2024, 08:55.
Tags
None
Referenced Files
F3299676: D25588.1743026065.diff
Tue, Mar 25, 21:54
F3291823: D25588.1742882758.diff
Mon, Mar 24, 06:05
F3285688: D25588.1742806665.diff
Sun, Mar 23, 08:57
F3261837: D25588.1742510084.diff
Wed, Mar 19, 22:34
F3249443: D25588.1742286137.diff
Mon, Mar 17, 08:22
F3151934: D25588.1741226946.diff
Wed, Mar 5, 02:09
F3151933: D25588.1741226945.diff
Wed, Mar 5, 02:09
F3147896: D25588.1741216528.diff
Tue, Mar 4, 23:15

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.

This patch also fixes two similar strlen() occurrences in the same source file.

ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php:167]
Test Plan

Run ../phorge/bin/bulk export --query --format: Get no strlen() error anymore but only expected output Usage Exception: Query "--format" is unknown. To run a builtin query like "all" or "active", also specify the search engine with "--class".

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable