Commit Graph

2290 Commits

Author SHA1 Message Date
jeroendedauw e6da6bb0d4 Restore unused var 2014-07-31 12:30:50 +02:00
jeroendedauw d8e1077fd1 Get rid of naming clash
Static code analysis tool did not like this.
Looks like it was wrong before. Tests unchanged though.
2014-07-31 10:38:31 +02:00
jeroendedauw 3e50672029 Remove unused local vars 2014-07-31 10:37:48 +02:00
jeroendedauw 291141f869 Remove unused var 2014-07-31 10:37:40 +02:00
jeroendedauw 99215549a9 Fix type hint
In PHPStorm the inferred type was 'A'
2014-07-31 10:37:12 +02:00
jeroendedauw 1d2b8777d0 Fix type hint
PHPStorm wrongly inferred the type 'Unicode'
2014-07-31 10:36:30 +02:00
Fabien Potencier 4134169b67 minor #1457 Fixed the matches operator code example (brandonkelly)
This PR was merged into the 1.16-dev branch.

Discussion
----------

Fixed the `matches` operator code example

A customer just pointed out that your `matches` operator code example wasn't working for them, and it ended up being because its backslashes themselves needed to be escaped by additional backslashes. (I've verified this.)

While I was editing it, I also switched to forwardslash delimiters on the regex, since those are much more commonly used than curly brackets. (I hadn't even been aware that curly brackets are allowed.) To back that assertion up, [PHP's official preg_quote() docs](http://php.net/manual/en/function.preg-quote.php) state:

> The `/` is the most commonly used delimiter.

Commits
-------

33dcbc8 Fixed the `matches` operator code example
2014-07-29 13:54:16 +02:00
Brandon Kelly 33dcbc8c76 Fixed the matches operator code example
It wasn't working because the backslashes themselves needed to be escaped by additional backslashes. Also switched to using forwardslashes for the regex delimiters rather than curly brackets.
2014-07-28 11:37:46 -07:00
Fabien Potencier 7d1577ff3c bug #1453 Fix for mb function overload mb_substr acting different (1emming)
This PR was squashed before being merged into the 1.16-dev branch (closes #1453).

Discussion
----------

Fix for mb function overload mb_substr acting different

When bug hunting https://github.com/fabpot/Twig/issues/1428 I ran into an issue.
I started out by changing my `php.ini` for the `cli` enviroment, I've added:
`mbstring.func_overload = 2`
Later I tested with adding and removing:
`mbstring.internal_encoding = 'UTF-8'`

It turns out `mb_substr` returns `false` and not `''` when doing something like this:

```php
$item = '';
$start = -1;
$length = 1;
$charset = 'UTF-8';
$a = mb_substr($item, $start, $length, $charset);
var_dump($a);
die;
```

I'm not sure this will fix 1428 since I don't have enough information for this, but this PR should at least fix one issue.

Commits
-------

214fe52 Fix for mb function overload mb_substr acting different
2014-07-28 15:12:00 +02:00
1emming 214fe52174 Fix for mb function overload mb_substr acting different 2014-07-28 15:11:49 +02:00
Fabien Potencier 5fd428ed76 fixed some typos 2014-07-08 15:46:25 +02:00
Fabien Potencier 82a034c591 minor #1333 Added disambiguation on using raw in expressions (OwlyCode)
This PR was merged into the 1.16-dev branch.

Discussion
----------

Added disambiguation on using raw in expressions

I recently got in trouble using the ``raw`` filter in a ternary, leading to a value being escaped and me not expecting it. The code was :

```
{{ foo|striptags|length > 250 ? foo|striptags|slice(0, 250) ~ '...' : foo|raw }}
```

When foo's length was under 250 characters, the result of this expression was escaped. Here is the updated documentation to explain why.

Commits
-------

cec2b57 Added disambiguation on using raw in expressions
2014-07-08 15:44:12 +02:00
Fabien Potencier 31e2a79735 minor #1431 Typo in deprecated.rst (barryvdh)
This PR was merged into the 1.16-dev branch.

Discussion
----------

Typo in deprecated.rst

Commits
-------

06ca7f9 Typo in deprecated.rst
2014-07-08 15:42:48 +02:00
Fabien Potencier 11ea5976e3 bumped version to 1.16.1-DEV 2014-07-07 14:54:10 +02:00
Barry vd. Heuvel 06ca7f9837 Typo in deprecated.rst 2014-07-05 14:50:30 +02:00
Fabien Potencier 8ce3711580 prepared the 1.16.0 release v1.16.0 2014-07-05 14:19:05 +02:00
Fabien Potencier eed777f8d8 replaced deprecated divisibleby by divisible by in tests 2014-07-05 14:12:06 +02:00
Fabien Potencier eeeef75f0a replaced deprecated sameas by same as in tests 2014-07-05 14:06:29 +02:00
Fabien Potencier 1e71b52757 fixed some deprecation notices 2014-07-05 14:03:33 +02:00
Fabien Potencier f4c41f78a5 fixed the deprecated docs about PEAR 2014-07-05 13:37:05 +02:00
Fabien Potencier 23efa7b1c2 fixed potential exception 2014-07-05 13:16:15 +02:00
Fabien Potencier 251af26c75 minor #1426 Add 'PHP-twig for atom' package to IDEs support (zoltanradics)
This PR was squashed before being merged into the 1.16-dev branch (closes #1426).

Discussion
----------

Add 'PHP-twig for atom' package to IDEs support

Since Atom.io editor is growing, i would add this package to the list for people who would like to edit Twig in Atom.

Commits
-------

c90d469 Add 'PHP-twig for atom' package to IDEs support
2014-07-05 11:31:17 +02:00
Zoltan Radics c90d46988f Add 'PHP-twig for atom' package to IDEs support 2014-07-05 11:31:15 +02:00
Fabien Potencier 96336aba60 minor #1422 Update slice.rst (1emming)
This PR was merged into the 1.16-dev branch.

Discussion
----------

Update slice.rst

Please state that Twig `slice` is  multi-byte safe since it uses `mb_substr` :)

Commits
-------

87165e7 Update slice.rst
2014-06-20 09:26:46 +02:00
Seb Minderhoud 87165e7ea5 Update slice.rst 2014-06-19 09:49:36 +02:00
Fabien Potencier 1c0bec2814 added a note in the docs about the fact that installing the C ext is optional 2014-05-26 17:15:28 +02:00
Fabien Potencier 7c63a7df8a feature #1390 fixed url_encode when raw is false and URL is an array (Tobion, fabpot)
This PR was merged into the 1.16-dev branch.

Discussion
----------

fixed url_encode when raw is false and URL is an array

alternative for #1388

Commits
-------

1930600 fixed url_encode when raw is false and URL is an array
49ba6b4 removed parameter from url_encode filter
2014-05-26 02:34:04 +02:00
Fabien Potencier 1930600e4e fixed url_encode when raw is false and URL is an array 2014-05-26 02:31:15 +02:00
Tobias Schultze 49ba6b4759 removed parameter from url_encode filter
the filter now only uses the more appropriate rawurlencode() which is also more consistent with the escape('url') filter
2014-05-26 02:23:10 +02:00
Fabien Potencier 4a7ef0ce0f updated CHANGELOG 2014-05-26 02:01:07 +02:00
Fabien Potencier f1aee16381 bug #1370 Fixed inheritance in a 'use'-hierarchy (hason)
This PR was merged into the 1.15-dev branch.

Discussion
----------

Fixed inheritance in a 'use'-hierarchy

Fixes #1365

Commits
-------

9e0907e Fixed inheritance in a 'use'-hierarchy
2014-05-26 02:00:46 +02:00
Fabien Potencier bee07e534b updated CHANGELOG 2014-05-26 01:57:56 +02:00
Fabien Potencier 02b80626f0 bug #1382 Added isSandbox check around the __toString check in Sandbox extension (Scott Smith, smitherz82)
This PR was merged into the 1.15-dev branch.

Discussion
----------

Added isSandbox check around the __toString check in Sandbox extension

The `__toString` policy check currently still happens when the sandbox is disabled

Commits
-------

3ce4202 Added test for sandbox __toString when not enabled
8dfa432 Added isSandbox check around the __toString check
2014-05-26 01:57:06 +02:00
Fabien Potencier e6156e2e4d minor #1403 Refactor namespace/shortname parsing into own method (anlutro)
This PR was merged into the 1.15-dev branch.

Discussion
----------

Refactor namespace/shortname parsing into own method

I've written a custom file loader in order for the namespace syntax to match across different resource loading classes. To achieve this I have to replace the loadTemplate method, which includes a lot of logic. While this logic may not be likely to change anytime soon, I'd feel better if the namespace parsing was extracted into its own method so I can replace just that bit.

Commits
-------

9dd3bb8 Refactor namespace/shortname parsing into own method
2014-05-26 01:56:03 +02:00
Fabien Potencier fce3b8a928 minor #1409 Update json_encode.rst (matthieuprat)
This PR was merged into the 1.15-dev branch.

Discussion
----------

Update json_encode.rst

Commits
-------

1b3ac0a Update json_encode.rst
2014-05-26 01:53:41 +02:00
Fabien Potencier 1f5b998453 minor #1413 [Doc]Put the return of the split filter in a variable (n1c01a5)
This PR was squashed before being merged into the 1.15-dev branch (closes #1413).

Discussion
----------

[Doc]Put the return of the split filter in a variable

Commits
-------

0e228c7 [Doc]Put the return of the split filter in a variable
2014-05-26 01:53:14 +02:00
Wagner Nicolas 0e228c719a [Doc]Put the return of the split filter in a variable 2014-05-26 01:53:13 +02:00
Matthieu Prat 1b3ac0aa16 Update json_encode.rst 2014-05-22 20:35:52 +02:00
Andreas Lutro 9dd3bb8220 Refactor namespace/shortname parsing into own method
Allows you to more easily create a custom file loader with a custom
namespace syntax.
2014-05-22 09:10:34 +02:00
Fabien Potencier c2ae310203 minor #1406 Improve the description of the 'same as' test (adamelso)
This PR was merged into the 1.15-dev branch.

Discussion
----------

Improve the description of the 'same as' test

This description of the `same as` test is based on the description in the docblock for `Twig_Node_Expression_Test_Sameas`. It reads better than the one currently used in the docs.

Commits
-------

e4b7db1 Improve the description of the 'same as' test
2014-05-21 03:15:25 +02:00
Adam Elsodaney e4b7db1705 Improve the description of the 'same as' test
This description of the 'same as' test is based on the description in the docblock for Twig_Node_Expression_Test_Sameas. It reads better than the one currently used in the docs.
2014-05-20 15:02:48 +01:00
Fabien Potencier 55253c3f37 minor #1401 [Twig][Tests][Fixtures][filters] Added empty string tests for "first" and "last" filters (ureimers)
This PR was squashed before being merged into the 1.15-dev branch (closes #1401).

Discussion
----------

[Twig][Tests][Fixtures][filters] Added empty string tests for "first" and "last" filters

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT

This was already fixed with with https://github.com/fabpot/Twig/commit/6003ae43b92cfa7e1ddec17262733355e0bf435a but to make sure there won't be any regression bugs in the future. This is an edge case but the first and the last element of an empty string are empty strings too.
Before the above mentioned PR this threw a notice `Uninitialized string offset: 0`.

Commits
-------

0db5c31 [Twig][Tests][Fixtures][filters] Added empty string tests for "first" and "last" filters
2014-05-15 21:43:48 +02:00
Ulf 0db5c3100b [Twig][Tests][Fixtures][filters] Added empty string tests for "first" and "last" filters 2014-05-15 21:43:46 +02:00
Fabien Potencier 6af8182fbd minor #1399 Fixed typo (WouterJ)
This PR was merged into the 1.15-dev branch.

Discussion
----------

Fixed typo

Commits
-------

49de7a6 Fixed typo
2014-05-14 13:51:43 +02:00
Wouter J 49de7a6b04 Fixed typo 2014-05-14 11:53:45 +02:00
Fabien Potencier cd4a372738 added some missing tests 2014-05-12 16:45:36 +02:00
Fabien Potencier 16e30cff9f minor #1398 Remove unused constructor arguments (rybakit)
This PR was merged into the 1.15-dev branch.

Discussion
----------

Remove unused constructor arguments

There are no line & tag arguments in `Twig_Node_Module::__construct()`.

Commits
-------

5b5741a Remove unused constructor arguments
2014-05-12 16:36:16 +02:00
Eugene Leonovich 5b5741a7a4 Remove unused constructor arguments
There are no `line` and `nodeTag` arguments in `Twig_Node_Module::__construct()`
2014-05-12 16:12:37 +02:00
Fabien Potencier 052eb5d1ed fixed markpu 2014-05-05 10:48:03 +02:00
Fabien Potencier 84dcec3086 removed beta versions for PEAR in the docs 2014-05-05 10:32:59 +02:00