The eval ('?> <? Php') effect in a symfony source
Line 3083 of is var/cache/dev/classes.phpgiven in my Symfony project:
eval('?>'.$content);
When I look through my debugger, I see that it is $contentset to "<?php". So, the command executed here, eval('?><?php');and I suppose it should just exit and re-enter php. But my stack trace says:
at Symfony\Component\Routing\Router->generate('openid/server', array(), '1')
in vendor/symfony/symfony/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php line 45
at Symfony\Bridge\Twig\Extension\RoutingExtension->getPath('openid/server')
in var/cache/dev/classes.php(3083) : eval()'d code line 106
at __TwigTemplate_796eabb7be58900d71ef26da18735885230dda71cde4d67f04a324145cd5ea80->doDisplay(array('app' => object(AppVariable)), array())
in var/cache/dev/classes.php line 4759
Line 106 whose file was executed?
+4
2 answers
Something I just found out the other day:
A At the very beginning of the PHP tag, a newline character should follow or it will cause a syntax error.
So this code:
'?><?php'
is not syntactically correct. But it will be:
'?><?php ' // followed by space
and it will be:
'?><?php ' // followed by tab
and it will be:
'?><?php
' // followed by newline or carriage return
, , , $content '<?php ', ? eval (- , , ):
eval('?>'.$content. PHP_EOL);
, ?
+4