Commit Graph

3494 Commits

Author SHA1 Message Date
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
Arjen van der Meijden 3bea610e12 Use null rather than specific length for 'all characters to the end' with mb_substr 2017-01-17 08:40:03 +01:00
Fabien Potencier 465689da4d bumped version to 2.1.1-DEV 2017-01-11 11:39:41 -08:00
Fabien Potencier 9062992538 prepared the 2.1.0 release v2.1.0 2017-01-11 11:39:01 -08:00
Fabien Potencier 6dc830e5b0 updated CHANGELOG 2017-01-11 11:22:03 -08:00
Fabien Potencier 0f2cbf5afd bug #2356 do not overridde case-insentive cache entries (xabbuh)
This PR was merged into the 2.x branch.

Discussion
----------

do not overridde case-insentive cache entries

This will fix #2343.

Commits
-------

2c153bd1 do not overridde case-insentive cache entries
2017-01-11 11:13:21 -08:00
Christian Flothmann 2c153bd10f do not overridde case-insentive cache entries 2017-01-11 18:30:44 +01:00
Fabien Potencier 9ef01e8cbc Merge branch '1.x' into 2.x
* 1.x:
  Turned fatal error into exception when a previously generated cache prevents loading its newly compiled version
2017-01-11 08:02:12 -08:00
Fabien Potencier feb9bf539f bug #2354 Turned fatal error into exception when a previously generated cache prevents loading its newly compiled version (nicolas-grekas)
This PR was merged into the 1.x branch.

Discussion
----------

Turned fatal error into exception when a previously generated cache prevents loading its newly compiled version

Not sure if this is testable, yet this should save some hours to people that end up in the same trap we did on our project.
It turned out we generated some twig template cache in two separate commands, in a situation where "index" tracking for embeds where lost.

This PR detects the situation and invites to clear the cache properly, because that's the only way to fix the issue.

It also fixes a mistake in the cache $key generation, that should not take $index into account.
Doing so were making offline cache warmup useless in some situations.

Commits
-------

95c10991 Turned fatal error into exception when a previously generated cache prevents loading its newly compiled version
2017-01-11 08:01:13 -08:00
Nicolas Grekas 95c109919a Turned fatal error into exception when a previously generated cache prevents loading its newly compiled version 2017-01-11 16:22:32 +01:00
Fabien Potencier 5527658f08 Merge branch '1.x' into 2.x
* 1.x:
  removed years in (c) in files (we have them in the referenced main LICENSE file)
2017-01-10 14:15:38 -08:00
Fabien Potencier 4e1c232b67 removed years in (c) in files (we have them in the referenced main LICENSE file) 2017-01-10 14:14:10 -08:00
Fabien Potencier f02005ecd6 bumped version to 2.1.0 2017-01-10 14:08:27 -08:00
Fabien Potencier a92ec89b31 Merge branch '1.x' into 2.x
* 1.x:
  updated CHANGELOG
  fixed typo
  feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output
  bumped version to 1.31.0
  Delay marking the environment as initialized until it is done
  Fix the argument name of filter replace
2017-01-10 14:07:32 -08:00
Fabien Potencier 0f9f76a17b updated CHANGELOG 2017-01-10 14:04:11 -08:00
Fabien Potencier 44eba84e24 fixed typo 2017-01-10 14:02:12 -08:00
Fabien Potencier 751c05bddd feature #2341 feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output (brandonkelly)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2341).

Discussion
----------

feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output

This implements the feature originally suggested by #2045, but specifically in the manner suggested by #2340, which I think is more consistent with existing Twig code.

Commits
-------

bc6a9133 feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output
2017-01-10 14:01:09 -08:00
brandonkelly bc6a91335d feature #2045 Adds Twig_NodeCaptureInterface for nodes that capture all output 2017-01-10 14:01:09 -08:00
Fabien Potencier 3cdbd325d4 bumped version to 1.31.0 2017-01-10 14:00:36 -08:00
Fabien Potencier b7b55edddf minor #2350 Remove obsolete code (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Remove obsolete code

Commits
-------

4977bb5d removed obsolete code
2017-01-10 07:42:31 -08:00
Fabien Potencier 4977bb5d1b removed obsolete code 2017-01-10 07:15:43 -08:00
Fabien Potencier 2a05ea563d minor #2348 remove condition on PHP version (MatTheCat)
This PR was merged into the 2.x branch.

Discussion
----------

remove condition on PHP version

Twig now requires PHP >= 7 so there is no need to check for prior version.

Commits
-------

df185584 remove condition on PHP version
2017-01-10 07:05:50 -08:00
Mathieu df1855840e remove condition on PHP version
Twig now requires PHP >= 7 so there is no need to check for prior version.
2017-01-10 12:07:12 +01:00
Fabien Potencier a058fde56f minor #2346 Typehint the function, filter and test names as string (stof)
This PR was merged into the 2.x branch.

Discussion
----------

Typehint the function, filter and test names as string

This gives faster feedback when using the class in a wrong way, instead of getting a ``Warning: Illegal offset type in ExtensionSet.php line 434`` during the function registration (see https://github.com/symfony/symfony/issues/21212 for a case getting this message)

Commits
-------

2b4642c3 Typehint the function, filter and test names as string
2017-01-09 12:30:07 -08:00
Fabien Potencier d192cdce8c bug #2345 Delay marking the environment as initialized until it is done (stof)
This PR was merged into the 1.x branch.

Discussion
----------

Delay marking the environment as initialized until it is done

This avoids breaking the symfony exception page rendering saying that filters are not available due to a partial initialization: https://github.com/symfony/symfony/issues/21212
It would report the initialization error instead.

Commits
-------

a33fb6ce Delay marking the environment as initialized until it is done
2017-01-09 12:28:52 -08:00
Christophe Coevoet 2b4642c3ec Typehint the function, filter and test names as string 2017-01-09 17:16:00 +01:00
Christophe Coevoet a33fb6ce2c Delay marking the environment as initialized until it is done 2017-01-09 17:10:34 +01:00
Fabien Potencier 94acd37011 minor #2330 Fix the argument name of filter replace (jean-pasqualini)
This PR was merged into the 1.x branch.

Discussion
----------

Fix the argument name of filter replace

The argument name in the code is $from

See https://github.com/jean-pasqualini/Twig/blob/1.x/lib/Twig/Extension/Core.php#L475.

Issue : https://github.com/twigphp/Twig/issues/2329

Commits
-------

c8f69d76 Fix the argument name of filter replace
2017-01-05 11:55:35 -08:00
Fabien Potencier 9a311813d1 minor #2332 Fix class names to use non-1.x ones (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Fix class names to use non-1.x ones

Commits
-------

5c8a6249 fixed class names
2017-01-05 11:52:29 -08:00
Fabien Potencier 5c8a624963 fixed class names 2017-01-05 11:38:57 -08:00
Fabien Potencier 470955735a fixed typo 2017-01-05 11:25:04 -08:00
Fabien Potencier 48b2f5cef0 added the missing deprecated doc 2017-01-05 09:36:31 -08:00
Jean pasqualini c8f69d764b Fix the argument name of filter replace
The argument name in the code is $from

See https://github.com/jean-pasqualini/Twig/blob/1.x/lib/Twig/Extension/Core.php#L475.

Issue : https://github.com/twigphp/Twig/issues/2329
2017-01-05 18:35:52 +01:00
Fabien Potencier 303115cf6c bumped version to 2.0.1-DEV 2017-01-05 09:13:42 -08:00
Fabien Potencier 2a86dde128 prepared the 2.0.0 release v2.0.0 2017-01-05 09:12:02 -08:00
Fabien Potencier ae0b2f08e0 Merge branch '1.x' into 2.x
* 1.x:
  tweaked PHP CS Fixer rules
2017-01-04 14:06:08 -08:00
Fabien Potencier cfd709b16e tweaked PHP CS Fixer rules 2017-01-04 14:05:59 -08:00
Fabien Potencier ad0564a7ee Merge branch '1.x' into 2.x
* 1.x:
  updated copyright year
  Minor typo in class name
  fixed CS
2017-01-02 12:22:25 -08:00
Fabien Potencier 4528cc717d updated copyright year 2017-01-02 12:22:20 -08:00
Fabien Potencier 5d1f37c881 minor #2322 Minor typo in class name (BenjaminPaap)
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes #2322).

Discussion
----------

Minor typo in class name

Commits
-------

ce90852 Minor typo in class name
2016-12-29 22:21:24 +01:00
Benjamin Paap ce90852541 Minor typo in class name 2016-12-29 22:21:24 +01:00
Fabien Potencier 91938100bb fixed CS 2016-12-27 11:58:11 +01:00
Fabien Potencier b8bd97eaa0 Merge branch '1.x' into 2.x
* 1.x:
  Optimize usage of Traversable/Iterator
  Fix typo in phpdoc
  fix C89 compat
2016-12-27 11:56:33 +01:00
Fabien Potencier 289dad5898 minor #2265 Optimize usage of Traversable/Iterator (SpacePossum)
This PR was squashed before being merged into the 1.x branch (closes #2265).

Discussion
----------

Optimize usage of Traversable/Iterator

Commits
-------

2bdcfb6 Optimize usage of Traversable/Iterator
2016-12-27 11:56:08 +01:00
SpacePossum 2bdcfb6743 Optimize usage of Traversable/Iterator 2016-12-27 11:56:06 +01:00
Fabien Potencier cbb7c9cf25 fixed CS 2016-12-27 08:19:00 +01:00
Fabien Potencier 5268900793 minor #2319 Fix typo in phpdoc (chalasr)
This PR was merged into the 1.x branch.

Discussion
----------

Fix typo in phpdoc

Commits
-------

6a720ab Fix typo in phpdoc
2016-12-26 08:10:59 +01:00
Robin Chalas 6a720ab263 Fix typo in phpdoc 2016-12-25 11:15:02 +01:00
Fabien Potencier 166922bcfe feature #2318 removed remaining mentions of the C extension (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

removed remaining mentions of the C extension

Commits
-------

57ebf00 removed remaining mentions of the C extension
2016-12-24 11:36:01 +01:00
Fabien Potencier ae05130032 bug #2317 fix C89 compat (Jan-E)
This PR was merged into the 1.x branch.

Discussion
----------

fix C89 compat

@tucksaun @fabpot The extension did not compile anymore with old MSVC compilers. This PR contains the fix.

Commits
-------

c6be57f fix C89 compat
2016-12-24 11:35:17 +01:00