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

Block, invalid passed variables #363

Open
Izolant opened this issue Jun 5, 2024 · 0 comments
Open

Block, invalid passed variables #363

Izolant opened this issue Jun 5, 2024 · 0 comments

Comments

@Izolant
Copy link

Izolant commented Jun 5, 2024

Version: 3.1

Bug Description

Variables are passed invalid to block

Steps To Reproduce

The issue you can reproduce on: https://fiddle.nette.org/nette/#87a55c3e23

Expected Behavior

$name = hack instead error, or $value = hack (as hack is 2nd passed variable to block)

Possible Solution

Instead of rendering block with parameters in array => maybe could be used variadic arguments?

Ie, instead:
$this->renderBlock('BLOCK', [$name, 0 => 'hack'] + [], 'html') /* line 1 */;
$name = $ʟ_args[0] ?? $ʟ_args['name'] ?? null;
$value = $ʟ_args[1] ?? $ʟ_args['value'] ?? null;

use:
$this->renderBlock('BLOCK', $this->parameters($name, 01, 02), 'html') /* line 1 */;
$name = $ʟ_args[0] ?? null;
$value = $ʟ_args[1] ?? null;

public function parameters(...$allParams){
return $allParams;
}

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

No branches or pull requests

1 participant