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
F21526365: D2486.id.diff
Fri, Jan 23, 02:22
Unknown Object (File)
Thu, Jan 22, 10:42
Unknown Object (File)
Thu, Jan 22, 08:10
Unknown Object (File)
Sat, Jan 17, 20:32
Unknown Object (File)
Fri, Jan 16, 14:59
Unknown Object (File)
Thu, Jan 15, 02:53
Unknown Object (File)
Thu, Jan 15, 01:14
Unknown Object (File)
Wed, Jan 14, 21:04
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