Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update smarty_internal_compile_capture.php #138

Closed
wants to merge 1 commit into from

Conversation

s4uliu5
Copy link

@s4uliu5 s4uliu5 commented Dec 19, 2015

Added missing ().

Without them "{if}", with several "$smarty.capture.X" in condition, generates incorrect code.

e.g. before this change, smarty code

{if $smarty.capture.A || $smarty.capture.B}

generates code

<?php if (isset($_smarty_tpl->_cache['__smarty_capture']['A']) ? $_smarty_tpl->_cache['__smarty_capture']['A'] : null || isset($_smarty_tpl->_cache['__smarty_capture']['B']) ? $_smarty_tpl->_cache['__smarty_capture']['B'] : null) {?>

which evaluates incorrectly.

After this change generated code is

<?php if ((isset($_smarty_tpl->_cache['__smarty_capture']['A']) ? $_smarty_tpl->_cache['__smarty_capture']['A'] : null) || (isset($_smarty_tpl->_cache['__smarty_capture']['B']) ? $_smarty_tpl->_cache['__smarty_capture']['B'] : null)) {?>

which evaluates correctly.

Added missing ().

Without them "{if}", with several "$smarty.capture.X" in condition, generates incorrect code.

e.g. before this change, smarty code

```
{if $smarty.capture.A || $smarty.capture.B}
```

generates code

```php
<?php if (isset($_smarty_tpl->_cache['__smarty_capture']['A']) ? $_smarty_tpl->_cache['__smarty_capture']['A'] : null || isset($_smarty_tpl->_cache['__smarty_capture']['B']) ? $_smarty_tpl->_cache['__smarty_capture']['B'] : null) {?>
```
which evaluates incorrectly.

After this change generated code is

```php
<?php if ((isset($_smarty_tpl->_cache['__smarty_capture']['A']) ? $_smarty_tpl->_cache['__smarty_capture']['A'] : null) || (isset($_smarty_tpl->_cache['__smarty_capture']['B']) ? $_smarty_tpl->_cache['__smarty_capture']['B'] : null)) {?>
```
which evaluates correctly.
@uwetews
Copy link
Contributor

uwetews commented Dec 19, 2015

The patch is now in the master branch

@uwetews uwetews closed this Dec 19, 2015
@s4uliu5 s4uliu5 deleted the patch-1 branch December 19, 2015 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants