Commit Graph

3546 Commits

Author SHA1 Message Date
Fabien Potencier 261c4ec92d bug #2415 Add error message when calling parent() in a block that doesn't exist (pierredup)
This PR was squashed before being merged into the 2.x branch (closes #2415).

Discussion
----------

Add error message when calling parent() in a block that doesn't exist

Related: #2309

When calling `parent()` in a block that isn't defined in the parent template, you get an error message that states `Block "%s" on template "%s" does not exist`, even if the block is wrapped in an `is defined` check, which is confusing and makes debugging hard.

This fix adds a better error message indicating that you should not call `parent()` when the parent block is not defined.

Before:
![screen shot 2017-03-08 at 08 08 38](https://cloud.githubusercontent.com/assets/144858/23693410/0e476242-03dd-11e7-9621-4442bdc6bf05.png)

After:
![screen shot 2017-03-08 at 08 56 18](https://cloud.githubusercontent.com/assets/144858/23693424/234d9c2e-03dd-11e7-8d07-4e277d80f7e4.png)

Commits
-------

4587f676 Add error message when calling parent() in a block that doesn't exist
2017-03-10 08:55:37 -08:00
Pierre du Plessis 4587f67621 Add error message when calling parent() in a block that doesn't exist 2017-03-10 08:55:35 -08:00
Fabien Potencier 82004b85f8 bug #2384 Fix undef. source in exception. (SpacePossum)
This PR was merged into the 2.x branch.

Discussion
----------

Fix undef. source in exception.

closes https://github.com/twigphp/Twig/issues/2383

Two things:
- the tests fails without a corrupt cache, so maybe the message is of or the cache generation is off (i.e. not respecting the `$index`)
- passing the `$source` seems superfluous (but maybe that is only the case in the exception message)

Commits
-------

772373cf Fix undef. source in exception.
2017-03-05 13:51:23 -08:00
Fabien Potencier 31bf7951fd bumped version to 2.2.1-DEV 2017-02-26 16:17:12 -08:00
Fabien Potencier 29bb02dde0 prepared the 2.2.0 release v2.2.0 2017-02-26 16:16:20 -08:00
Fabien Potencier d37b38d79b Merge branch '1.x' into 2.x
* 1.x:
  bumped version to 1.32.1-DEV
  prepared the 1.32.0 release
  udpated CHANGELOG
  improved some tests
  removed trailing space
2017-02-26 16:08:51 -08:00
Fabien Potencier 27d7ea9675 bumped version to 1.32.1-DEV 2017-02-26 16:07:56 -08:00
Fabien Potencier 9935b662e2 prepared the 1.32.0 release v1.32.0 2017-02-26 16:07:03 -08:00
Fabien Potencier 48e17f7c63 udpated CHANGELOG 2017-02-26 15:19:41 -08:00
Fabien Potencier b0ec8390f8 improved some tests 2017-02-23 06:58:09 -08:00
Fabien Potencier 8ff73ca55b removed trailing space 2017-02-23 06:56:46 -08:00
Fabien Potencier 4569e476a8 Merge branch '1.x' into 2.x
* 1.x:
  fixed CS
  #1802 left/right trim
2017-02-23 06:55:46 -08:00
Fabien Potencier af0d787c43 fixed CS 2017-02-23 06:54:27 -08:00
Fabien Potencier c84a511f52 feature #2403 #1802 left/right trim (antonydandrea)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2403).

Discussion
----------

#1802 left/right trim

It was said in this thread that there was a preference of adding parameters to the trim filter in order to implement this.

So this feature works like:

trim(character_mask, mode), where mode is either "both", "left" or "right". It is by default "both".

This is my first pull request of this project, so I apologise in advance if something is wrong.

Commits
-------

7d8e7550 #1802 left/right trim
2017-02-23 06:52:12 -08:00
Antony D'Andrea 7d8e75504c #1802 left/right trim 2017-02-23 06:52:03 -08:00
Fabien Potencier 236c429ee0 Merge branch '1.x' into 2.x
* 1.x:
  added some missing tests
2017-02-21 18:52:53 -08:00
Fabien Potencier 30085c5e78 bug #2407 added some missing tests (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

added some missing tests

Commits
-------

236c1bdc added some missing tests
2017-02-21 18:52:36 -08:00
Fabien Potencier 236c1bdc32 added some missing tests 2017-02-21 18:49:28 -08:00
Fabien Potencier 39c74d99db Merge branch '1.x' into 2.x
* 1.x:
  Fix tokenize call in DeprecationCollector
2017-02-21 08:25:58 -08:00
Fabien Potencier bb3f4d6183 bug #2406 Fix tokenize call in DeprecationCollector (vdechenaux)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2406).

Discussion
----------

Fix tokenize call in DeprecationCollector

Hi,

if fixes `Argument 1 passed to Twig_Environment::tokenize() must be an instance of Twig_Source, string given`

Commits
-------

13ca97c1 Fix tokenize call in DeprecationCollector
2017-02-21 07:46:47 -08:00
Vincent Dechenaux 13ca97c16f Fix tokenize call in DeprecationCollector 2017-02-21 07:46:38 -08:00
Fabien Potencier 3cf0ac46f4 tweaked docs 2017-02-17 11:35:58 -08:00
Fabien Potencier 764927d0df updated tests for PHP 7+ 2017-02-17 11:34:19 -08:00
Fabien Potencier a818ab3ac3 bumped version to 2.2 2017-02-17 11:33:43 -08:00
Fabien Potencier 9578c35227 Merge branch '1.x' into 2.x
* 1.x:
  fixed tests for PHP 5.2
  fixed tests for PHP 5.2
  fixed tests for PHP 5.2
  Fix typo in test filename
  added a note in the docs about the PSR-11 runtime loader
  fixed typo
  updated CHANGELOG
  bumped version to 1.32
  Add ContainerRuntimeLoader
  tweaked docs
  Update striptags.rst
  fixed CS
  Mention autoescape=true deprecation (issue #2386)
  Fix typo.
  bumped version to 1.31.1-DEV
  prepared the 1.31.0 release
  added a note about macros usage in the deprecated docs
2017-02-17 11:32:53 -08:00
Fabien Potencier b6a16a21f9 fixed tests for PHP 5.2 2017-02-17 11:29:51 -08:00
Fabien Potencier 7f9928d85c minor #2402 Fix typo in test filename (chalasr)
This PR was merged into the 1.x branch.

Discussion
----------

Fix typo in test filename

Commits
-------

e5860f1f Fix typo in test filename
2017-02-17 11:27:19 -08:00
Fabien Potencier f63c6e1a9a fixed tests for PHP 5.2 2017-02-17 11:26:43 -08:00
Fabien Potencier ef2a7d7c36 fixed tests for PHP 5.2 2017-02-17 11:23:47 -08:00
Robin Chalas e5860f1fac Fix typo in test filename 2017-02-17 20:19:55 +01:00
Fabien Potencier 7efe539b82 added a note in the docs about the PSR-11 runtime loader 2017-02-17 11:16:50 -08:00
Fabien Potencier c9ce259c9f fixed typo 2017-02-17 11:15:01 -08:00
Fabien Potencier 056689f719 updated CHANGELOG 2017-02-17 11:14:29 -08:00
Fabien Potencier d2863a89c8 feature #2401 Add ContainerRuntimeLoader (chalasr)
This PR was merged into the 1.x branch.

Discussion
----------

Add ContainerRuntimeLoader

Next to https://github.com/symfony/symfony/pull/21625#discussion_r101715445

Commits
-------

964a51bc Add ContainerRuntimeLoader
2017-02-17 11:12:59 -08:00
Fabien Potencier f08c06ed7e bumped version to 1.32 2017-02-17 11:10:54 -08:00
Robin Chalas 964a51bc02 Add ContainerRuntimeLoader 2017-02-17 19:29:40 +01:00
Fabien Potencier 7203d493f2 minor #2391 Change ~ with ^ for version in composer require (bocharsky-bw)
This PR was merged into the 2.x branch.

Discussion
----------

Change ~ with ^ for version in composer require

Caret symbol sticks closer to semantic versioning, and will always allow non-breaking updates

Commits
-------

8a62689d Change '~' with '^' for version in composer require
2017-02-16 03:31:21 -08:00
Victor Bocharsky 8a62689d44 Change '~' with '^' for version in composer require
Caret symbol sticks closer to semantic versioning, and will always allow non-breaking updates
2017-02-16 09:57:42 +02:00
Fabien Potencier d6715ac8c3 tweaked docs 2017-02-03 13:34:15 -08:00
Fabien Potencier 86f9e9a6d0 minor #2371 Update striptags.rst (peter17)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2371).

Discussion
----------

Update striptags.rst

Add information about supported param. Replaces #2370

Commits
-------

048f5490 Update striptags.rst
2017-02-03 13:32:21 -08:00
Peter Potrowl 048f549017 Update striptags.rst 2017-02-03 13:32:21 -08:00
Fabien Potencier 73de309fb4 fixed CS 2017-02-03 13:30:43 -08:00
Fabien Potencier e675c08a90 minor #2388 Mention autoescape=true deprecation (issue #2386) (vphantom)
This PR was squashed before being merged into the 1.x branch (closes #2388).

Discussion
----------

Mention autoescape=true deprecation (issue #2386)

Per #2386, mention the deprecation of true in favor of an explicit "html".

Commits
-------

70d03042 Mention autoescape=true deprecation (issue #2386)
2017-02-03 13:29:56 -08:00
Stéphane Lavergne 70d03042df Mention autoescape=true deprecation (issue #2386) 2017-02-03 13:29:55 -08:00
SpacePossum 772373cfd3 Fix undef. source in exception. 2017-01-31 10:46:11 +01:00
Fabien Potencier 2b0d2cb71c minor #2374 Remove legacy exception catch blocks from 2.x (chalasr)
This PR was merged into the 2.x branch.

Discussion
----------

Remove legacy exception catch blocks from 2.x

These `catch` blocks were only useful for compatibility with PHP versions prior to 7.0.

Commits
-------

352c01a0 Remove legacy exception catches from 2.x
2017-01-23 13:36:30 -08:00
Robin Chalas 352c01a078 Remove legacy exception catches from 2.x 2017-01-23 22:20:42 +01:00
Fabien Potencier a1c1f01eac minor #2368 Fix typo in annotation of utest. (SpacePossum)
This PR was merged into the 1.x branch.

Discussion
----------

Fix typo in annotation of utest.

Commits
-------

61d31c8f Fix typo.
2017-01-19 06:55:10 -08:00
SpacePossum 61d31c8fef Fix typo. 2017-01-19 14:08:47 +01:00
Fabien Potencier dbbb7401a3 bug #2366 Use null rather than specific length for 'to the end' in mb_substr (arjenm)
This PR was merged into the 2.x branch.

Discussion
----------

Use null rather than specific length for 'to the end' in mb_substr

We use Twig with a ISO-8859-15 charset and noticed the 'capitalize'-method only yielded the first character of a string. I.e. "abcd" became "A" rather than "Abcd".

This was due to a change in the way mb_substr is used. Appearantly, using 2147483647 as a length to indicate 'everything to the end' only works with UTF-8 (and possibly other multibyte charsets). It probably triggers some internal overflow in php for at least ASCII and ISO-8859-15.

Luckily, an easy fix is available since PHP 5.4.8: just use 'null'

See these two tests for which version does what:
(old) https://3v4l.org/qdpIK
(new) https://3v4l.org/kivqK

I also used null in the slice-method. While it did not suffer from this same issue, it did an unnecessary mb_strlen. And there might be similar overflow issues with negative values of $start, but I didn't actually test that.

Commits
-------

3bea610e Use null rather than specific length for 'all characters to the end' with mb_substr
2017-01-17 07:18:35 -08:00