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
F13266029: D2486.diff
Fri, Nov 21, 01:05
F13266004: D2486.id6266.diff
Fri, Nov 21, 01:05
Unknown Object (File)
Wed, Nov 19, 22:14
Unknown Object (File)
Sun, Nov 16, 15:04
Unknown Object (File)
Fri, Nov 14, 20:48
Unknown Object (File)
Fri, Nov 14, 12:15
Unknown Object (File)
Thu, Nov 13, 22:34
Unknown Object (File)
Mon, Nov 10, 09:56
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