Last active
August 29, 2015 14:23
-
-
Save ebernhardson/ca4ac13859610ae6b4f6 to your computer and use it in GitHub Desktop.
When running reproduce.php both eval'd pieces of code output "first", but the second one should be outputting "second"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return function ($in, $debugopt = 1) { | |
return (function() {return 'first';})(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function processTemplate( $templateName ) { | |
$code = file_get_contents( __DIR__ . "/$templateName.php" ); | |
echo $code, "\n\n"; | |
$template = eval( $code ); | |
return $template( array() ); | |
} | |
echo processTemplate( 'first' ); | |
echo "\n-----\n\n"; | |
echo processTemplate( 'second' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return function ($in, $debugopt = 1) { | |
return (function() {return 'second';})(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment