Commit Graph

1400 Commits

Author SHA1 Message Date
Martin Hasoň bd89ec8c9b Added travis build file 2012-04-23 23:30:30 +02:00
Fabien Potencier a512973f83 merged branch hhamon/parser_cleanup (PR #708)
Commits
-------

81a1049 [Parser] removed useless else clause.

Discussion
----------

[Parser] removed useless else clause.
2012-04-23 20:24:11 +02:00
Hugo Hamon 81a1049d7f [Parser] removed useless else clause. 2012-04-23 18:00:48 +02:00
Fabien Potencier f79a56b431 fixed compatibility with PHP 5.2 and simplify code a bit 2012-04-22 08:57:54 +02:00
Fabien Potencier e7313a7825 fixed template line number in some exceptions 2012-04-21 22:21:37 +02:00
Fabien Potencier cf73b64556 added unit tests to prove the issue with the current introspection exception code 2012-04-21 19:43:26 +02:00
Fabien Potencier 07a953e016 tweaked the iterable example in the docs 2012-04-21 15:46:26 +02:00
Fabien Potencier fa0b0985c3 tweaked the iterable example in the docs 2012-04-21 07:33:50 +02:00
Fabien Potencier a929d0336b merged branch martinml/master (PR #705)
Commits
-------

3eecc60 Silence chmod() warnings (operation not permitted) when using CIFS mounts and possibly other cases.

Discussion
----------

Silence chmod() warnings (operation not permitted) when using CIFS

When using chmod() in a CIFS mount (NTFS) in Linux, Twig 1.6.5 in PHP 5.3.3 throws a warning:

    Warning: chmod(): Operation not permitted in /smb/.../Twig/Environment.php on line 1052

There may be other combinations that trigger this warning. Related Symfony issue: https://github.com/symfony/symfony/issues/2125
2012-04-20 20:17:16 +02:00
Fabien Potencier efcd8c5f25 fixed doc 2012-04-20 20:14:01 +02:00
Fabien Potencier 48aae186c9 updated CHANGELOG 2012-04-20 20:12:57 +02:00
Fabien Potencier b20a74868b removed the array test and rename the traversable test to iterable 2012-04-20 20:12:41 +02:00
Fabien Potencier da9d2eb834 merged branch Seldaek/isarray (PR #700)
Commits
-------

c88f8e5 Micro-optimizations
70cca66 Simplify code
d78ed66 Add traversable test
5fd2f98 Add docs
b2e1675 Add is array test

Discussion
----------

is array/traversable tests

It's sometimes necessary to display arbitrary data to be able to know if we should recurse or not.

---------------------------------------------------------------------------

by stof at 2012-04-13T12:13:11Z

I'm not sure about the need for ``is array``. All Twig functions related to arrays also support traversable objects

---------------------------------------------------------------------------

by Seldaek at 2012-04-13T12:23:32Z

Well, I like to have both for explicitness and also because I would try is array without looking at the docs, and I don't think it's right to make is array return true for traversables.

---------------------------------------------------------------------------

by fabpot at 2012-04-20T09:38:33Z

One of the main goal of Twig is to abstract the "real" type of the variables. We have already discussed the introduction of many tests like these ones and I have always rejected them.

As many people seems to have a need for them (especially for arrays), I would consider adding the `traversable` test. But as @stof said, Twig tries to blur the difference between traversable objects and arrays, so I'm -1 for adding another test for arrays.

`traversable` is probably not the best name for web designers but I don't know what else we can use here.

---------------------------------------------------------------------------

by stof at 2012-04-20T09:41:05Z

In Jinja, there is a built-in test for this using ``iterable``: http://jinja.pocoo.org/docs/templates/#builtin-tests

---------------------------------------------------------------------------

by Seldaek at 2012-04-20T09:41:32Z

Ok. I can live with dropping the array test. Now for the name,  `is forloopable`? I am kind of at a loss as well apart from traversable. I think if it's clearly mentioned in the docs it's ok.

---------------------------------------------------------------------------

by Seldaek at 2012-04-20T09:52:12Z

iterable sounds ok to me, but just as confusing as traversable I guess to the unknowing. A sidenote, if I update the PR, any objection to adding the "undefined" test as well?

---------------------------------------------------------------------------

by fabpot at 2012-04-20T10:01:27Z

Let's use `iterable` as this is what Jinja already uses. Why would you want an `undefined` test as we already have `defined`? (`if foo is not defined` works well enough)

---------------------------------------------------------------------------

by Seldaek at 2012-04-20T11:16:26Z

I just saw jinja had it on that page, and I thought why not add it too? Still not a huge fan of the "not" for negation.

---------------------------------------------------------------------------

by fabpot at 2012-04-20T12:18:17Z

Well, let's first finish the `iterable` test first and let's discuss `undefined` in another PR or issue.

---------------------------------------------------------------------------

by fabpot at 2012-04-20T17:10:28Z

I can finish the PR is you want.

---------------------------------------------------------------------------

by Seldaek at 2012-04-20T17:13:11Z

If you like sure, it's mostly deleting code anyway. I just have to finish some work stuff now..
2012-04-20 20:09:05 +02:00
martinml 3eecc609f4 Silence chmod() warnings (operation not permitted) when using CIFS mounts and possibly other cases. 2012-04-20 21:01:06 +03:00
Fabien Potencier 944a014636 renamed preserve_safety to preserves_safety to be consisten with needs_context and needs_environment 2012-04-20 19:04:30 +02:00
Fabien Potencier 43245cbd34 merged branch stof/preserve_safe (PR #684)
Commits
-------

0cbf5a0 Added an option to mark filters as preserving the safeness

Discussion
----------

Added an option to mark filters as preserving the safeness

Closes #678

I haven't written a test for this yet as I don't know how to provide a stub filter (as none of the core filters use this option) for the setup of the testsuite.

---------------------------------------------------------------------------

by fabpot at 2012-04-07T20:15:36Z

@stof: Can you also add some information in the phpdoc with an example so that people understand more easily when and why you would want to use this new option? Thanks.

---------------------------------------------------------------------------

by fabpot at 2012-04-07T20:16:36Z

Also, adding a unit test that demonstrates the bug you had in #678 would be good.

---------------------------------------------------------------------------

by stof at 2012-04-20T08:33:58Z

@fabpot none of the core filters are using this options, so what is the right way to add a test ?

---------------------------------------------------------------------------

by fabpot at 2012-04-20T08:36:26Z

by defining a filter in the test that uses it.

---------------------------------------------------------------------------

by stof at 2012-04-20T08:39:06Z

but is it possible to register a filter from the tests with the custom stuff used by Twig ?

---------------------------------------------------------------------------

by fabpot at 2012-04-20T08:48:06Z

in integrationTest.php, we already have quite a few functions and filters registered. I would just be a matter of adding a new one.

---------------------------------------------------------------------------

by stof at 2012-04-20T16:17:01Z

@fabpot renamed, tested and squashed
2012-04-20 19:02:27 +02:00
Christophe Coevoet 0cbf5a004c Added an option to mark filters as preserving the safeness
Closes #678
2012-04-20 16:23:51 +02:00
Fabien Potencier 0add6e2377 added an error when defining two blocks with the same name in a template (closes #701) 2012-04-20 11:17:22 +02:00
Fabien Potencier 6cf147dc99 added some missing tests for nested blocks 2012-04-20 10:56:03 +02:00
Fabien Potencier 037f86aa55 added a note in the documentation about what the C exension does 2012-04-18 07:19:25 +02:00
Fabien Potencier 5799a889c0 added missing parameters to Twig_Error_Syntax 2012-04-16 09:04:57 +02:00
Jordi Boggiano c88f8e540e Micro-optimizations 2012-04-13 15:48:00 +02:00
Jordi Boggiano 70cca66c5a Simplify code 2012-04-13 14:22:03 +02:00
Jordi Boggiano d78ed667ad Add traversable test 2012-04-13 13:05:17 +02:00
Jordi Boggiano 5fd2f98720 Add docs 2012-04-13 12:58:41 +02:00
Jordi Boggiano b2e1675f0c Add is array test 2012-04-13 12:57:54 +02:00
Fabien Potencier 4e28408ce1 fixed a PHP notice when trying to access a key on a non-object/array variable 2012-04-12 14:36:25 +02:00
Fabien Potencier 58fbe0da41 updated CHANGELOG 2012-04-11 16:52:26 +02:00
Fabien Potencier fd634d1af2 merged branch Tobion/random-fix (PR #693)
Commits
-------

06361ca added note in changelog
2706412 fixed random function when charset is null

Discussion
----------

Fixed random function when charset is null

Fixed random function when charset is null and the value is an empty string, resulting in an mt_rand error max(-1) is smaller than min(0).
Also fixed a test on windows.

But I don't know why you introduced the special handling for `null === $env->getCharset()`.
Why is that necessary and why is it possible to have a null charset at all? Usually it defaults to utf-8 anyway.
2012-04-09 18:27:10 +02:00
Tobias Schultze 06361ca346 added note in changelog 2012-04-09 09:30:01 +02:00
Tobias Schultze 27064127ad fixed random function when charset is null 2012-04-09 09:26:53 +02:00
Fabien Potencier 46ae99fa4c merged branch igorw/composer (PR #691)
Commits
-------

72d3c19 [composer] Add branch alias for dev-master, adjust some other things

Discussion
----------

[composer] Add branch alias for dev-master, adjust some other things

* branch alias allows installation of dev-master by requiring 1.7.*, which is important since most packages depend on twig "<2.0.0"
* remove the version field, the version is determined by branch names and tags only
* change license to BSD-3, this is more explicit and the preferred format for BSD licenses
2012-04-08 14:20:37 +02:00
Fabien Potencier 1b47b40104 enhanced error reporting when the template file is an instance of SplFileInfo 2012-04-08 14:12:00 +02:00
Igor Wiedler 72d3c19e71 [composer] Add branch alias for dev-master, adjust some other things
* branch alias allows installation of dev-master by requiring 1.7.*, which is important since most packages depend on twig "<2.0.0"
* remove the version field, the version is determined by branch names and tags only
* change license to BSD-3, this is more explicit and the preferred format for BSD licenses
2012-04-08 14:07:23 +02:00
Fabien Potencier fe3c17f51f added a tip in the doc 2012-04-08 12:58:26 +02:00
Fabien Potencier c6bf195e21 added a unit test to demonstrate the need to pass blocks when calling renderBlock|displayBlock 2012-04-07 22:40:59 +02:00
Fabien Potencier a39784432a merged branch igorw/patch-1 (PR #689)
Commits
-------

11d4c6a [doc] Remove backticks in intro doc

Discussion
----------

[doc] Remove backticks in intro doc
2012-04-07 18:15:20 +02:00
Igor Wiedler 11d4c6af6a [doc] Remove backticks in intro doc 2012-04-07 18:38:17 +03:00
Fabien Potencier 7bc8ca5be7 merged branch markstory/loop-docs (PR #688)
Commits
-------

2a7102d Update docs concerning loop.last.

Discussion
----------

Update docs concerning loop.last.

Add docs for #687. `loop.last` is not defined when looping with conditions.
2012-04-07 16:41:37 +02:00
mark_story 2a7102d059 Update docs concerning loop.last. 2012-04-07 09:50:44 -04:00
Fabien Potencier fbacbe60ad added some more information about unknown variable/attributes in the doc (closes #685) 2012-04-05 22:53:39 +02:00
Fabien Potencier f2f1f32b41 added Twig_Environment::mergeGlobals() 2012-04-03 19:13:43 +02:00
Fabien Potencier 3398b38cf0 fixed a regression when a template only extends another one without defining any blocks (closes #683) 2012-04-03 19:13:30 +02:00
Fabien Potencier e2220bb282 bumped version to 1.7.0-DEV 2012-04-03 09:56:57 +02:00
Fabien Potencier 8f242ca858 made usage of mergeContextWithGlobals in macros 2012-04-03 09:45:11 +02:00
Fabien Potencier b19ef8ea16 fixed doc markup 2012-04-03 09:10:53 +02:00
Fabien Potencier 81807ea95b fixed doc markup 2012-04-03 09:08:32 +02:00
Fabien Potencier 53e89ef2eb fixed doc indexes 2012-04-03 09:07:53 +02:00
Fabien Potencier e9c1433a99 renamed a test 2012-04-03 09:07:04 +02:00
Fabien Potencier 1f6e640d96 added compilation checks to avoid misuses of the sandbox tag 2012-04-03 09:03:41 +02:00