On Apr 7, 2012, at 10:53, John Crenshaw wrote:
> I don't like this, but it's closer. I hate the idea of adding a whole mess of
> one-off functions just to support a single coding style feature that doesn't
> seem to have very much support. There are a variety of other ideas that have
> been floating around that request changes to how the parser handles specific
> code (different short tags, sandboxing, auto-escaping, etc.).
>
> What if you have just ONE function with a variety of options? Something like:
>
> execute_file('path/to/foo.php', array(
> 'require'=>true,
> 'once'=>true,
> 'begin_code'=>'<?php ',
> 'shorttags'=>array('<?=','?>'),
> 'autoescape'=>function($str){return htmlentities($str, ENT_QUOTES |
> ENT_HTML5, 'UTF-8');},
> ...
> ));
While there's some elegance with your execute_file (there'd definitely be
benefits to one function instead of the four we have now), the extra options
would spawn so much Daily WTF material it wouldn't be funny, and I think most
people would just stick with include/require/*_once because there'd be a lot
less effort in the common case.
> This would provide a single consistent hook for any further DSL like features
> without impacting the behavior of any existing code. Some other options that
> might make sense:
>
> lint (like command line)
Actually, it'd be pretty cool to be able to lint a file without having to
include runkit (there is a runkit_lint($code)) or make an external call to php
-l.
> end_code (similar to command line, corresponds with begin_code (also command
> line))
> args (also command line)
> Any PHP_INI_ALL directives
>
> John Crenshaw
> Priacta, Inc.
-John
--
John Bafford
http://bafford.com/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php