Commit Graph

96 Commits

Author SHA1 Message Date
Simon Wisselink ded3e12c1c add missing folder for unit tests 2023-02-03 17:56:49 +01:00
Simon Wisselink 7408c18cdc WIP for performance improvements.
Removed $smarty->_current_file and $smarty->allow_ambiguous_resources properties, both unused. Removed public Source::filepath property.
Cached an Compiled files (and Exceptions) no longer rely on the filepath being set. Removed explicit tests for cached and compiled filenames. The exact implementation is not important. Added tests for compile_check property, fixing a file_exists check that would always be done on source template files, even when compile_check was true. Remove code duplication between Source en Config classes. Added a local $_smarty_current_dir to the generated code files for backwards compatability for {$smarty.current_dir}.
2023-02-03 15:50:31 +01:00
Simon Wisselink 016c9ceb17 Generated <script> tags lo longer have deprecated type="text/javascript" or language="Javascript" attributes.
Fixes #815.
2023-01-31 11:17:41 +01:00
Simon Wisselink 1ef29b65ea move test methods because some other test methods rely on their relative positions 2023-01-31 10:52:56 +01:00
Simon Wisselink b4019b6023 Add test for registering compiler plugin with positional params. Fixes #164 2023-01-31 10:41:09 +01:00
Simon Wisselink 0962a34670 verify that native PHP functions cannot be used as a modifier and verify that an easy userland workaround exists. Fixes #813. 2023-01-31 10:10:32 +01:00
Simon Wisselink 18a8068df1 Throw compile error when using a modifier where it won't work. Fixes #526. 2023-01-31 09:54:44 +01:00
Simon Wisselink c47756b489 Re-organized rendering (read source / compile / cache) process to avoid circular dependencies. 2023-01-26 12:58:15 +01:00
Simon Wisselink 169cd924df Re-organized rendering (read source / compile / cache) process to avoid circular dependencies.
Deactivated merge_compiled_includes and the {include inline} attribute. They don't seem to do much in terms of performance, but we'll
have to check back.
2023-01-25 16:59:10 +01:00
Simon Wisselink 1a8ee6ebda Merge branch 'master' into smarty5 2023-01-24 12:53:58 +01:00
Simon Wisselink ecfa4bfa16 Fixed getCachedContent 2023-01-24 12:09:47 +01:00
Simon Wisselink 9cc60f5e38 Convert isset and empty to modifiercomilers, and smooth the error handling to fix unit tests. 2023-01-24 12:01:20 +01:00
Simon Wisselink 431d77505f Fixed all scope assignment bugs 2023-01-24 10:16:00 +01:00
Simon Wisselink c5f555eed4 Drop a unit tests bc we no longer support direct access to PHP-functinos such as sin() 2023-01-23 16:59:52 +01:00
Simon Wisselink ecac24d073 Fixed bug in {include} variable assignment and removed some unused/unrequired code 2023-01-23 16:40:27 +01:00
Simon Wisselink f1c3ac4395 Fixed all inheritance issues 2023-01-23 11:45:29 +01:00
Simon Wisselink 4bbe94f4e0 Removed the undocumented {block_parent} and {parent} alternatives to {$smarty.block.parent}
and {block_child} and {child} alternatives to {$smarty.block.child}
2023-01-22 23:01:05 +01:00
Simon Wisselink bdb379d8fb Simply the "isFresh" method by not including the first param anymore. Fix a couple of unit tests by respecting tag_nocache set by nocache vars used in a tag. 2023-01-22 22:44:45 +01:00
Simon Wisselink 2fbf67b32e Moved handling of smarty.block.* to special compilers, because they aren't real tags. Organized tag-stack handling in compiler, unified nocache handling in compiler. 2023-01-20 17:22:00 +01:00
Simon Wisselink 390f34318d Fixed cacheability of block plugins. 2023-01-19 23:29:10 +01:00
Simon Wisselink f5b432dea4 Fixed scope in variable assignments in included and extended templates, fixed dependencies for testing freshness of caches. Added some unit tests and fixed a class reference to pass some more tests. 2023-01-13 23:29:05 +01:00
Simon Wisselink 73ff8fd3d0 Fix unit tests that broke because now is now in 2023 2023-01-13 22:19:17 +01:00
Simon Wisselink d900a0ef4a Added variable scope test for multi-level extends resource 2023-01-13 19:23:12 +01:00
Simon Wisselink 5c74dc4a83 Replaced a bunch of direct property access with getters/setters. 2023-01-13 16:55:15 +01:00
Simon Wisselink 3be63a3418 Removed unneeded magic setters/getters/destructors and the like. 2023-01-13 15:56:25 +01:00
Simon Wisselink cdf1ed2a50 Simplified the (no)caching architecture by:
- removing support for $cache_attrs for registered plugins,
- removing the undocumented {make_nocache} tag and the deprecated {insert} tag and associated code
- removing support for a compile_id property on include tags.

Fixes a bug in extends: resources by propagating the nocache-hashes between a master template and it's subtemplates in \Smarty\Template::_subTemplateRender. This might need further improvement.
2023-01-13 15:47:57 +01:00
Simon Wisselink e0f2c36d4d converted 3 public properties on Template into getters/setters. unified Template creation code. Provided a getter/setter for the has_nocache_code property. Removed the useless DataObject class. Fixed a few tests. Removed the variable-allow-php-templates property from the docs. 2023-01-13 00:04:08 +01:00
Simon Wisselink 536721d457 Removed the allowUndefinedVars check from the smarty error handlers, because undefined vars no longer throw an error, unless smarty->error_unassigned is set to true. 2023-01-12 09:59:10 +01:00
Simon Wisselink 577f910e49 removed phpplugin, removed now unused uncompiled handler and all checks for this, fixed a refactorbug in InheritanceRuntime. Moved getRenderedTemplateCode method to Smarty\Template. Renamed Cache en Compiled base class to GeneratedPhpFile for more clarity and distinction from Resource classes. Inlined Cached::create into its only caller. Some other minor improvements. Removed php7.1 CI tests. 2023-01-11 23:33:12 +01:00
Simon Wisselink 22ce23b47b Made variable scoping more sensible 2023-01-11 11:22:24 +01:00
Simon Wisselink ad245ccd0c Fixed minor unit tests 2023-01-11 00:00:07 +01:00
Simon Wisselink 51075e0421 WIP fixing the complicated variables scopes architecture. Right now more tests are failing than before... :( 2023-01-10 23:49:33 +01:00
Simon Wisselink 3d10630510 WIP rewriting variable scopes 2023-01-10 17:35:34 +01:00
Simon Wisselink 9651dafbce WIP replacing direct access tpl_vars with proper getter/setters. 2023-01-10 14:46:33 +01:00
Simon Wisselink e124f71dd8 Fixed issue related to scoping of left/right delimiter overrides 2023-01-09 11:25:09 +01:00
Simon Wisselink 34d5d6d024 Rewrote global static global_tpl_vars to getters/setters on Smarty class, fixing several test cases. Added a ::getValue() method to Variable. 2023-01-09 09:55:22 +01:00
Simon Wisselink 861aafa92c 2 small fixes for unit tests 2023-01-07 23:45:59 +01:00
Simon Wisselink fd64cc688a Removed PHP functions and checks for the already removed php modifiers. Re-implemented functions as regular functions. Probably should compile these directly. 2023-01-07 23:06:47 +01:00
Simon Wisselink e595cd2a5d Fixed BC loading of resource pluging from dir and all ResourcePluginTest tests 2023-01-06 21:53:37 +01:00
Simon Wisselink b2e11ee2b8 Removed deprecated extends_recursion property and fix bug in CodeFrame compiler due to use of clone. 2023-01-06 21:43:48 +01:00
Simon Wisselink f07e342d61 Removed now unneeded PHPunit annotations @run(Tests)InSeparateProcess, @preserveGlobalState and @backupStaticAttributes. Made CacheResourceTestCommon abstract to prevent the base class from running tests (and always failing). Unregister a previously registered stream wrapper. Fixes a lot of tests. 2023-01-05 23:06:02 +01:00
Simon Wisselink 576bd4cc01 Removed support for PHP include path, and removed the ::loadPlugin method. 2023-01-05 21:58:29 +01:00
Simon Wisselink e89a3dda49 Implemented the DefaultHandlerBlockCompiler, made the dependencies of the template compiler into properties, fixed a couple of unit tests 2023-01-05 11:18:42 +01:00
Simon Wisselink 3cc61133a3 Fix code duplication in block compilers and fix (most) BlockPluginTests. Default plugin handler blocks still need fixing. 2023-01-04 23:45:57 +01:00
Simon Wisselink 41054cfb05 Fixed DefaultPluginHandlerTest for function plugins (blocks still break) 2023-01-04 12:16:10 +01:00
Simon Wisselink 16c7fe1d4f Fixed setfilter 2023-01-03 22:03:43 +01:00
Simon Wisselink 3fccb54093 Fixed CacheResource implementation and tests 2023-01-03 17:10:02 +01:00
Simon Wisselink 98ad1a13af Fixed TemplateObject test 2023-01-03 14:20:40 +01:00
Simon Wisselink 9766aba66e filter tests passing 2023-01-03 14:12:36 +01:00
Simon Wisselink b9ecf115dd fixed pre/post/output filters and removed some old todo-comments 2023-01-02 23:26:36 +01:00