File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
Security/Tests/BadFunctions Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ eval ('$var = file_get_contents( \'filename.php \'); ' );
4+ eval ($ string );
5+ eval ("\$var = file_get_contents( $ filename );');
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Unit test class for the NoEvals sniff.
4+ *
5+ * @covers \PHPCS_SecurityAudit\Security\Sniffs\BadFunctions\NoEvalsSniff
6+ */
7+
8+ namespace PHPCS_SecurityAudit \Security \Tests \BadFunctions ;
9+
10+ use PHPCS_SecurityAudit \Security \Tests \AbstractSecurityTestCase ;
11+
12+ class NoEvalsUnitTest extends AbstractSecurityTestCase
13+ {
14+
15+ /**
16+ * Returns the lines where errors should occur.
17+ *
18+ * The key of the array should represent the line number and the value
19+ * should represent the number of errors that should occur on that line.
20+ *
21+ * @return array<int, int>
22+ */
23+ public function getErrorList ()
24+ {
25+ return [
26+ 3 => 1 ,
27+ 4 => 1 ,
28+ 5 => 1 ,
29+ ];
30+ }
31+
32+ /**
33+ * Returns the lines where warnings should occur.
34+ *
35+ * The key of the array should represent the line number and the value
36+ * should represent the number of warnings that should occur on that line.
37+ *
38+ * @return array<int, int>
39+ */
40+ public function getWarningList ()
41+ {
42+ return [];
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments