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
F25030262: D2486.id6266.diff
Thu, Mar 26, 06:51
F25027857: D2486.id6267.diff
Thu, Mar 26, 03:13
F25027450: D2486.diff
Thu, Mar 26, 02:40
Unknown Object (File)
Tue, Mar 24, 21:35
Unknown Object (File)
Sun, Mar 22, 17:58
Unknown Object (File)
Tue, Mar 17, 10:19
Unknown Object (File)
Tue, Mar 17, 10:12
Unknown Object (File)
Tue, Mar 17, 08:45
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

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