Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception for "/bin/files encode" without --as parameter
ClosedPublic

Authored by aklapper on Apr 16 2024, 23:05.
Tags
None
Referenced Files
F2981852: D25595.1739940081.diff
Tue, Feb 18, 04:41
F2962039: D25595.1739170904.diff
Sun, Feb 9, 07:01
F2947330: D25595.1738461430.diff
Sat, Feb 1, 01:57
F2947166: D25595.1738449277.diff
Fri, Jan 31, 22:34
F2946889: D25595.1738426969.diff
Fri, Jan 31, 16:22
F2944590: D25595.1738273116.diff
Wed, Jan 29, 21:38
F2943271: D25595.1738174083.diff
Tue, Jan 28, 18:08
F2942570: D25595.1738119755.diff
Tue, Jan 28, 03:02

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: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php:45]
Test Plan

Run ../phorge/bin/files encode F1: Get no strlen() error anymore but only expected output Usage Exception: Use --as <format> to select a target encoding format. Available formats are: aes-256-cbc, rot13, raw.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable