cphalcon: [2.1.x] Function setVar() not working

I’ve upgrade to PHP 7.0.3 and Phalcon 2.1.x. But the code works well before upgrade can’t works now.

Here’s the code in controller:

class DefaultController extends BaseController {
    public function indexAction() {
        $this->view->setVar('appVersion', '2.0.0');
        $this->tag->prependTitle('Page Title');
    }
}

And here’s the code in views:

<?php echo $appVersion; ?>

And I got an error message:

Notice: Undefined variable: appVersion in /home/xiehaozhe/Development/PHP/TestZilla/app/views/default/index.phtml on line 3

What’s wrong with it?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

As i know symbol tables was changed in php 7 - this is why this code does not work.