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
F7157068: D2486.diff
Mon, Apr 21, 15:33
F7146036: D2486.id6267.diff
Mon, Apr 21, 11:23
F7144823: D2486.id6266.diff
Mon, Apr 21, 10:56
Unknown Object (File)
Sun, Apr 20, 09:22
Unknown Object (File)
Sat, Apr 19, 13:36
Unknown Object (File)
Sat, Apr 19, 08:42
Unknown Object (File)
Fri, Apr 18, 11:12
Unknown Object (File)
Wed, Apr 16, 07:23
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