Commit Graph

764 Commits

Author SHA1 Message Date
Fabien Potencier 9ee6fe3380 adding missing dots to some exception messages 2016-09-24 12:21:25 -07:00
Fabien Potencier 73d029b212 minor #2143 fixed exception message that might end with a ? (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

fixed exception message that might end with a ?

Commits
-------

5c43548 adding missing dots to some exception messages
fbf99fc fixed exception message that might end with a ?
2016-09-24 12:00:56 -07:00
Fabien Potencier b2a1805146 fixed error message 2016-09-24 12:00:09 -07:00
Javier Eguiluz 23f53d5968 Improved the error message when a child template defines contents outside parent blocks 2016-09-24 11:56:13 -07:00
Fabien Potencier 5c43548dde adding missing dots to some exception messages 2016-09-24 11:53:49 -07:00
Fabien Potencier b55d907c94 changed the way we store template source in template classes 2016-09-20 10:55:24 -07:00
Fabien Potencier 6f0e3edbc5 removed usage of realpath in cache key 2016-09-20 10:26:50 -07:00
Fabien Potencier 85fb2a1f45 fixed a test 2016-09-19 18:26:28 -07:00
Fabien Potencier a0489854ba fixed embed parent token for simple use cases 2016-09-19 16:37:28 -07:00
Fabien Potencier 03f18b44f4 enforced Node:: to only contain node instances 2016-09-19 13:32:58 -07:00
Fabien Potencier ec7a1c1856 changed a test to make it more robust 2016-09-18 18:37:13 -07:00
SpacePossum 39d46acf7d Floor - use cast and not intval 2016-08-31 11:41:06 -07:00
Fabien Potencier d726bde293 bug #2054 Fix static callable. (SpacePossum)
This PR was merged into the 1.x branch.

Discussion
----------

Fix static callable.

fixes https://github.com/twigphp/Twig/issues/2053

Commits
-------

8f6fd57 Fix exception message for static method and object without req. params.
2016-08-17 17:08:36 -07:00
Sam Mousa 17e0caa91a Fixed all deprecation notices by using 2016-07-28 16:56:02 -04:00
SpacePossum 8f6fd57a7e Fix exception message for static method and object without req. params. 2016-06-22 09:22:42 +02:00
Uwe Jäger ee6965ed00 fix a case where the autoescaping does not work as expected
The Twig_NodeVisitor_Escaper collects a list of blocks for all templates that it visits. If you define the same block (i.e. with the same name) in txt and html templates this results sometimes in the html block not being escapes.

This is illustrated in the added test.

To fix it, I propose to reset the list of the blocks for each module.

Alternatively we need to make clear that blocks should not share names between text and html templates.
2016-06-02 08:40:59 +02:00
Filip Procházka 99e9d1cf41 handle Throwable 2016-05-13 12:08:51 +02:00
Hugo Hamon 2e02f73bf7 [ExpressionParser] forbids true, false, null and none keywords for variables names. 2016-04-23 16:02:43 +02:00
chalasr d455b52e6b Clarify exception message in Twig_Template::getAttribute
Add missing parenthesis

Adapt twig.c extension

Update the C extension

Use php_ucfirst instead of ucfirst

Try to implement a TWIG_UCFIRST in C extension

Last try ucfirst

Rollback twig.c extension

Remove useless ucfirst + update twig.c extension

Fix mis-escaped char

Repeat argument item for sprintf (first try doesnt work)

Remove unexpected breakline in code
2016-03-31 13:09:57 +02:00
Fabien Potencier cdd57f33b5 adding support for the ?? operator 2016-01-25 17:15:20 +01:00
Fabien Potencier 62e8ee3124 fixed the defined test when used on a constant, a map, or a sequence 2016-01-25 16:58:02 +01:00
Fabien Potencier 24d9266d0f bug #1930 Fix Parser context push on stack (molaux)
This PR was squashed before being merged into the 1.x branch (closes #1930).

Discussion
----------

Fix Parser context push on stack

Hello,

With php7RC8, in Twig_Parser, parse method starts by saving current context in
copying self properties on stack. It sounds like get_object_vars returns now
references instead of copies of properties (at least for arrays). Consequently,
when reinitializing Parser for subparse line 92 to 99, the preserved context on
stack was also erased.

As a result, when calling {{ parent() }} after a {%embed%}{%endembed%}, the restored blockStack being empty, Twig throws a Twig_Error_Syntax('Calling "parent" outside a block is forbidden.'), despite the fact it is really in a block that extends another.
When calling {{ parent() }} before  the embed tag, all works properly. (It seems that the empty context, resulting of subparses, is not a problem as far as you don't need to access it)

Commits
-------

07ebdfe Fix Parser context push on stack
2016-01-11 15:50:45 +01:00
Marc-Olivier Laux 07ebdfef4d Fix Parser context push on stack 2016-01-11 15:50:44 +01:00
Fabien Potencier 8dacaeca7e minor #1954 Improve deprecations message (Ener-Getick)
This PR was merged into the 1.x branch.

Discussion
----------

Improve deprecations message

This PR specifies the version in which some ``Twig_SimpleTest`` were deprecated to make it easier to upgrade a package.

Commits
-------

fdb1937 Improve deprecations message Add the version in the message
2016-01-11 13:24:54 +01:00
Ener-Getick fdb19375f5 Improve deprecations message
Add the version in the message
2016-01-07 18:53:18 +01:00
Possum c3ec2fb1de Make file cache tolerant for trailing (back)slashes on directory configuration. 2016-01-06 10:29:32 +01:00
Tobias Schultze c6601a15c0 skip read-only dir tests on windows and cleanup tmp dirs correctly 2015-12-26 17:40:42 +01:00
Possum aa7c53ae0a Add dot to the end of exception messages. 2015-11-05 13:20:01 +01:00
Possum b8a6e72414 set back default 2015-11-05 12:52:55 +01:00
Possum d4e3adaaee Code grooming 2015-11-05 10:04:30 +01:00
Fabien Potencier e7e334c8b2 bug #1907 made exception messages more precise (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

made exception messages more precise

Replaces #1906 and #1902

Commits
-------

04d6738 fixed typos
2015-11-02 19:00:50 +01:00
Fabien Potencier 79af12a1d2 bug #1905 fix BC, revert to pre 1.23 behavior, and make use of pattern an option (remicollet)
This PR was merged into the 1.x branch.

Discussion
----------

fix BC, revert to pre 1.23 behavior, and make use of pattern an option

For context see twigphp/Twig-extensions#155

Commits
-------

ee5e25e fix BC, revert to pre 1.23 behavior, and make use of pattern an option
2015-11-02 15:52:06 +01:00
Fabien Potencier 04d6738ddf fixed typos 2015-11-02 15:47:58 +01:00
Fabien Potencier 20249a0320 fixed CS 2015-11-02 15:44:22 +01:00
Fabien Potencier 52b8d992dc minor #1904 make cache per user (on linux) (remicollet)
This PR was merged into the 1.x branch.

Discussion
----------

make cache per user (on linux)

Just because I hate having failed test when I run test once on 1 account, then once on another account ;)

Commits
-------

da5cac6 make cache per user (on linux)
2015-11-02 15:44:00 +01:00
Remi Collet ee5e25eb46 fix BC, revert to pre 1.23 behavior, and make use of pattern an option 2015-11-02 15:13:46 +01:00
Remi Collet da5cac6b54 make cache per user (on linux) 2015-11-02 15:09:33 +01:00
Fabien Potencier e3a325f249 deprecated Twig_ExtensionInterface::getGlobals() 2015-10-29 16:13:49 -07:00
Fabien Potencier 72485c2ea0 deprecated the possibility to override an extension by registering another one with the same name 2015-10-27 22:04:22 -07:00
Fabien Potencier 847d48e790 feature #1886 deprecated Twig_ExtensionInterface::initRuntime() (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

deprecated Twig_ExtensionInterface::initRuntime()

I'm working on splitting Twig extensions into 2 different phases: compilation and runtime. The goal is to avoid having to load the runtime environment of an extension when compiling templates. That also opens the way to be able to lazy-load Twig extensions.

While working on the split, I realized that the `initRuntime()` method on `Twig_ExtensionInterface` is not needed anymore. It was added at a time `needs_environment` did not exist and was a way to keep the environment around for custom filters/tests/functions. But nowadays, that's not needed anymore. I did a quick search on Github, and most of the implementation I found just store the environment in a local property, which is not needed anymore. So, I propose to deprecate it in 1.x and remove it in 2.0.

Commits
-------

9774f4f deprecated Twig_ExtensionInterface::initRuntime()
2015-10-27 20:46:45 -07:00
Fabien Potencier 12ea20245c fixed message inconsistency 2015-10-26 19:17:27 +01:00
Fabien Potencier 9774f4f1a4 deprecated Twig_ExtensionInterface::initRuntime() 2015-10-25 15:48:46 +01:00
Fabien Potencier 0468a7ede4 feature #1890 deprecated Twig_Environment::computeAlternatives() (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

deprecated Twig_Environment::computeAlternatives()

Commits
-------

d0a5ef8 deprecated Twig_Environment::computeAlternatives()
2015-10-25 12:39:22 +01:00
Fabien Potencier d0a5ef8cc0 deprecated Twig_Environment::computeAlternatives() 2015-10-25 09:10:27 +01:00
Fabien Potencier 6ddd911aa5 minor #1891 made the tests semantically more correct (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

made the tests semantically more correct

Calling `initRuntime()` is just a side-effect of loading a template.

Commits
-------

f839ad3 made the tests semantically more correct
2015-10-25 08:16:08 +01:00
Fabien Potencier f839ad328e made the tests semantically more correct 2015-10-25 08:12:33 +01:00
Jérôme Tamarelle a57b1cc3be Fix adding mock extension to Twig environment
When the extension class is not defined in a file but in eval'd code
we cannot assume ReflectionObject::getFileName will return
a valid file path.

https://bugs.php.net/bug.php?id=63901
2015-10-23 13:31:04 +02:00
Fabien Potencier aa1596785b fixed CS 2015-10-08 17:08:17 +02:00
Fabien Potencier 3347b9040e minor #1846 Add test coverage for auto_reload (znerol)
This PR was squashed before being merged into the 1.x branch (closes #1846).

Discussion
----------

Add test coverage for auto_reload

Fixes #1841

Commits
-------

1769f84 Add test coverage for auto_reload
2015-10-04 10:31:01 +02:00
Lorenz Schori 1769f84a4d Add test coverage for auto_reload 2015-10-04 10:31:00 +02:00