Page MenuHomeDevCentral

Avoid to compare shell_exec() result as false or null
ClosedPublic

Authored by dereckson on Jan 26 2022, 19:41.
Tags
None
Referenced Files
F53385411: D2486.id6266.diff
Fri, Oct 9, 09:29
F53382590: D2486.id6267.diff
Fri, Oct 9, 08:23
F53375278: D2486.id6267.diff
Fri, Oct 9, 06:08
F53356773: D2486.id6266.diff
Fri, Oct 9, 00:31
F53351531: D2486.diff
Thu, Oct 8, 22:59
Unknown Object (File)
Tue, Oct 6, 19:27
Unknown Object (File)
Tue, Oct 6, 16:30
Unknown Object (File)
Fri, Oct 2, 07:27
Subscribers
None

Details

Summary

When comparing the command output with a string,
shell_exec() can returns false or null.

If it returns null, trim will receives NULL value,
and that's behavior is deprecated under PHP 7.4+:

trim(null) would return:

Deprecated: trim(): Passing null to parameter #1 ($string)
of type string is deprecated

Diff Detail

Repository
rKOT Keruald OmniTools
Lint
Lint Skipped
Unit
Tests Skipped
Branch
shell_exec_can_return_false_or_null
Build Status
Buildable 3875
Build 4126: arc lint + arc unit

Event Timeline

dereckson created this revision.
This revision is now accepted and ready to land.Jan 26 2022, 19:42