Skip to content

Commit 875971a

Browse files
committed
UIMacros: {snippet} and {snippetArea} without name has name '' in both PHP 5 and PHP 7
1 parent 4f8f328 commit 875971a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Bridges/ApplicationLatte/UIMacros.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ public static function renderSnippets(Nette\Application\UI\Control $control, \st
114114
$payload = $control->getPresenter()->getPayload();
115115
if (isset($local->blocks)) {
116116
foreach ($local->blocks as $name => $function) {
117-
if ($name[0] !== '_' || !$control->isControlInvalid(substr($name, 1))) {
117+
if ($name[0] !== '_' || !$control->isControlInvalid((string) substr($name, 1))) {
118118
continue;
119119
}
120120
ob_start();
121121
$function = reset($function);
122122
$snippets = $function($local, $params + ['_snippetMode' => TRUE]);
123-
$payload->snippets[$id = $control->getSnippetId(substr($name, 1))] = ob_get_clean();
123+
$payload->snippets[$id = $control->getSnippetId((string) substr($name, 1))] = ob_get_clean();
124124
if ($snippets !== NULL) { // pass FALSE from snippetArea
125125
if ($snippets) {
126126
$payload->snippets += $snippets;

tests/Application.Latte/expected/UIMacros.snippet.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%A%
22
// block _
33
//
4-
if (!function_exists($_b->blocks['_'][] = '_%[a-z0-9]+%__')) { function _%[a-z0-9]+%__($_b, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v; $_control->redrawControl(false, FALSE)
4+
if (!function_exists($_b->blocks['_'][] = '_%[a-z0-9]+%__')) { function _%[a-z0-9]+%__($_b, $_args) { foreach ($_args as $__k => $__v) $$__k = $__v; $_control->redrawControl(%[false']+%, FALSE)
55
;
66
}}
77

0 commit comments

Comments
 (0)