mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 04:27:00 +00:00
cede5f3fbf81c5e686ae9b614404f3ca29f8b3b7
This PR was squashed before being merged into the 1.x branch (closes #2434).
Discussion
----------
Autoescape test addition; collision fix in Array Loader.
This PR makes two changes. It was created while testing a third issue that was discovered to be fixed in the latest version.
## Added JS to Autoescape: name test
This adds "index.js.html" to the autoescape:name test, proving the functionality of the JS escape system and the name guessing strategy.
## Fixed collision in Array Loader
While trying to run the above test, it was discovered that the Array Loader uses the content of the template file as the "key" for determining which compiled template to load.
As the above test uses identical content for both HTML and JS templates this led to the compiled HTML template always being loaded.
This change prepends the content with the filename, which vaguely follows the same mechanism as the "options" (which are appended after `getCacheKey` is called).
**This change might be a backwards-incompatible change** depending on your interpretation of how `Loader/Array` is intended to be used.
The class itself states:
> This loader should only be used for unit testing.
The assumption is it's OK for this to occur.
Test cases have been updated to take this key change into account, and an additional test has been added to confirm `Loader/Array` specifically has the capability to resolve two files with the same content to different keys.
Commits
-------
da82b41a Autoescape test addition; collision fix in Array Loader.
Twig, the flexible, fast, and secure template language for PHP ============================================================== Twig is a template language for PHP, released under the new BSD license (code and documentation). Twig uses a syntax similar to the Django and Jinja template languages which inspired the Twig runtime environment. More Information ---------------- Read the `documentation`_ for more information. .. _documentation: http://twig.sensiolabs.org/documentation
Description
Languages
PHP
99.9%