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

Phalcon\Mvc\View can't be extended correctly in Zephir #12460

Closed
ucando opened this issue Dec 8, 2016 · 5 comments
Closed

Phalcon\Mvc\View can't be extended correctly in Zephir #12460

ucando opened this issue Dec 8, 2016 · 5 comments
Labels
stale Stale issue - automatically closed

Comments

@ucando
Copy link

ucando commented Dec 8, 2016

Expected and Actual Behavior

I have an class extended Phalcon\Mvc\View write by Zephir, and it run well in Phalcon 3.0.1. when I upgrade to 3.0.2, it cause some "Undefined variable" notice, also the render system is broken. I review the code between 3.0.1 and 3.0.2 and found that many variables has defined as "[]", it seems the "[]" value can't be extend correctly. I write another php file to extend Phalcon\Mvc\View, and it can run well, so is it the bug of Zephir?

Fatal error: Uncaught exception 'Exception' with message 'The argument is not initialized or iterable()' in phalcon/mvc/view.zep:904 Stack trace: #0 [internal function]: Phalcon\Mvc\View->render('index', 'index', Array) #1 g:\website\project\public\index.php(35): Phalcon\Mvc\Application->handle() #2 {main} thrown in phalcon/mvc/view.zep on line 904

Provide minimal script to reproduce the issue

//this code can run
$pass['b'] = "b";
$this->view->setVar('a', "a");
$this->view->setVars($pass);

//this code can't
$pass['a'] = "a";
$pass['b'] = "b";
$this->view->setVars($pass);

Details

  • Phalcon version: 3.0.2
  • PHP Version: 5.6.1
  • Operating System: windows 10
  • Installation type: download dll
  • Zephir version (if any):
  • Server: Nginx
@gtux
Copy link

gtux commented Dec 8, 2016

Hi, Could you please put the setup of view object? Because I think the error have some relation with the value of templateBefore variable. The error that you get is the same that I had informed before on zephir:

zephir-lang/zephir#1328

@ucando
Copy link
Author

ucando commented Dec 9, 2016

very simple code, these code will cause error

use Phalcon\Mvc\View as PhalconView;

class View extends PhalconView {
    protected _var_a = [];

    public function someFunction() {

    }
}

but if I change the properties definition, it can run correctly.

use Phalcon\Mvc\View as PhalconView;

class View extends PhalconView {
    protected _var_a; //don't defined as array

    public function someFunction() {

    }
}

@sergeyklay
Copy link
Member

sergeyklay commented Dec 9, 2016

Cc: @SidRoberts

@SidRoberts
Copy link
Contributor

It sounds like a Zephir bug to me.

@stale
Copy link

stale bot commented Apr 16, 2018

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

@stale stale bot added the stale Stale issue - automatically closed label Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issue - automatically closed
Projects
None yet
Development

No branches or pull requests

4 participants