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
F3749324: D2486.diff
Sat, Nov 16, 14:33
Unknown Object (File)
Thu, Nov 14, 08:12
Unknown Object (File)
Sat, Nov 9, 04:41
Unknown Object (File)
Sun, Nov 3, 23:35
Unknown Object (File)
Wed, Oct 30, 08:23
Unknown Object (File)
Wed, Oct 23, 21:07
Unknown Object (File)
Fri, Oct 18, 19:39
Unknown Object (File)
Fri, Oct 18, 18:02
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