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
Unknown Object (File)
Fri, Dec 20, 05:02
Unknown Object (File)
Thu, Dec 19, 02:43
Unknown Object (File)
Thu, Dec 19, 02:21
Unknown Object (File)
Tue, Dec 17, 07:38
Unknown Object (File)
Mon, Dec 16, 18:51
Unknown Object (File)
Mon, Dec 16, 18:51
Unknown Object (File)
Fri, Dec 13, 11:55
Unknown Object (File)
Tue, Dec 10, 10:26
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