Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 971 Bytes

backtick_to_shell_exec.rst

File metadata and controls

38 lines (27 loc) · 971 Bytes

Rule backtick_to_shell_exec

Converts backtick operators to shell_exec calls.

Description

Conversion is done only when it is non risky, so when special chars like single-quotes, double-quotes and backticks are not used inside the command.

Examples

Example #1

--- Original
+++ New
 <?php
-$plain = `ls -lah`;
-$withVar = `ls -lah $var1 ${var2} {$var3} {$var4[0]} {$var5->call()}`;
+$plain = shell_exec("ls -lah");
+$withVar = shell_exec("ls -lah $var1 ${var2} {$var3} {$var4[0]} {$var5->call()}");

Rule sets

The rule is part of the following rule sets:

@PhpCsFixer
Using the @PhpCsFixer rule set will enable the backtick_to_shell_exec rule.
@Symfony
Using the @Symfony rule set will enable the backtick_to_shell_exec rule.