Conditions | 1 |
Paths | 1 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
23 | 3 | public function patch(array $statmentNodes) |
|
24 | { |
||
25 | 3 | $prettyPrinter = new Standard; |
|
26 | 3 | $newClassCode = $prettyPrinter->prettyPrintFile($statmentNodes).PHP_EOL; |
|
27 | |||
28 | // Force PHP interpreter to use modified version of the class, by evaluating. |
||
29 | 3 | eval('?>' . $newClassCode); |
|
|
|||
30 | 3 | } |
|
31 | } |
||
32 |
On one hand,
eval
might be exploited by malicious users if they somehow manage to inject dynamic content. On the other hand, with the emergence of faster PHP runtimes like the HHVM,eval
prevents some optimization that they perform.