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

[BUG] Volt Function Argument Error #13943

Closed
ghost opened this issue Apr 4, 2019 · 2 comments
Closed

[BUG] Volt Function Argument Error #13943

ghost opened this issue Apr 4, 2019 · 2 comments
Labels
not a bug Reported issue is not a bug

Comments

@ghost
Copy link

ghost commented Apr 4, 2019

This code worked fine in 4.0.0-alpha.2 but not in alpha3 and alpha4 what changed and how to fix it? I'm using PHP v7.3.4

ArgumentCountError:
Too few arguments to function Closure::{closure}(), 1 passed and exactly 2 expected
/project/app/config/bootstrap.php (62)

#0  Closure->{closure}(Object(Phalcon\Mvc\View))
#1  call_user_func(Object(Closure), Object(Phalcon\Mvc\View))
#2  Phalcon\Mvc\View->loadTemplateEngines()
#3  Phalcon\Mvc\View->render(index, test)
#4  Phalcon\Mvc\Application->handle(/)
$di->set('view', function() {
  $view = new View();
  $view->setViewsDir('../app/views/');
  $view->registerEngines([
    '.volt' => function($view, $di) {  // Line: #62
      $volt = new Volt($view, $di);
      $volt->setOptions([
        'compiledPath' => '../app/cache/',
        'compiledExtension' => '.html',
        'compiledSeparator' => '_',
      ]); #options
      return $volt;
    } #volt
  ]); #engines
  return $view;
}); #view

Thank You!

@sergeyklay
Copy link
Contributor

@sergeyklay sergeyklay added the not a bug Reported issue is not a bug label Apr 4, 2019
@ghost
Copy link

ghost commented Apr 4, 2019

@sergeyklay Thank you, I missed this in changelog. I wish you guys had important changes like this in seperate section in changelog. Like "Important" to indicate that it breaks previous features. I can confirm now, that this is not a bug. Below code works in v4.0.0-alpha.3 I haven't tried v4.0.0-alpha.4-pre-release will wait for v4.0.0-alpha.4-stable to test that.

$di->set('view', function() {
  $view = new View();
  $view->setViewsDir('../app/views/');
  $view->registerEngines([
    '.volt' => function($view) {
      $volt = new Volt($view, $this);
      $volt->setOptions([
        'compiledPath' => '../app/cache/',
        'compiledExtension' => '.html',
        'compiledSeparator' => '_',
      ]); #options
      return $volt;
    } #volt
  ]); #engines
  return $view;
}); #view

@niden niden added bug A bug report and removed bug A bug report labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Reported issue is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants