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]: Fatal error: Return value of Phalcon\Mvc\View\Engine\AbstractEngine::partial() must be of the type string, null returned in Unknown on line 0 Call Stack #14429

Closed
ixqbar opened this issue Sep 29, 2019 · 6 comments
Labels
breaks bc Functionality that breaks Backwards Compatibility bug A bug report hacktoberfest See https://hacktoberfest.digitalocean.com/ for participants details need script to reproduce Script is required to reproduce the issue status: medium Medium

Comments

@ixqbar
Copy link

ixqbar commented Sep 29, 2019

cphalcon-4.0.0-rc.1

<?php $this->partial('_partials/header'); ?>
<?php echo $this->getContent(); ?>
<?php $this->partial('_partials/footer'); ?>
@Jeckerson
Copy link
Member

Jeckerson commented Sep 29, 2019

Why you call second partial from view?

Instead

<?php $this->view->partial('_partials/footer'); ?>

Try

<?php $this->partial('_partials/footer'); ?>

@ixqbar
Copy link
Author

ixqbar commented Sep 29, 2019

i use

<?php $this->view->partial('_partials/header'); ?>
<?php echo $this->getContent(); ?>
<?php $this->view->partial('_partials/footer'); ?>

is ok

<?php $this->partial('_partials/header'); ?>
<?php echo $this->getContent(); ?>
<?php $this->partial('_partials/footer'); ?>

works fine on v3.4.4, but v4.0.0-rc.1 will ouput Fatal error

@niden
Copy link
Member

niden commented Sep 29, 2019

I need to confirm this but it seems that we will need to add null to the return type for partial

This is not an issue with v3 because it uses an older version of Zephir that allows this to pass, whereas v4 is more strict with interfaces and return types.

@niden niden added 4.0 breaks bc Functionality that breaks Backwards Compatibility and removed Bug - Unverified breaks bc Functionality that breaks Backwards Compatibility labels Sep 29, 2019
@ruudboon
Copy link
Member

@Jonnywang Can you give me some more info/code how to reproduce this issue?
Trying it based on the code above but unable to reproduce this errors.

@ruudboon ruudboon added the hacktoberfest See https://hacktoberfest.digitalocean.com/ for participants details label Oct 1, 2019
@niden niden added the need script to reproduce Script is required to reproduce the issue label Oct 3, 2019
@ixqbar
Copy link
Author

ixqbar commented Oct 4, 2019

class IndexController extends \Phalcon\Mvc\Controller
{

	public function todoAction()
	{
		$this->view->setMainView('_layouts/default');
	}

}

views/_layouts/default.phtml

<?php $this->partial('_partials/header'); ?>
<?php echo $this->getContent(); ?>
<?php $this->partial('_partials/footer'); ?>

views/_partials/header.phtml

views/_partials/footer.phtml

views/index/todo.phtml

env

macos php7.2.10

@niden
Copy link
Member

niden commented Oct 5, 2019

Resolved in #14447

@niden niden closed this as completed Oct 5, 2019
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks bc Functionality that breaks Backwards Compatibility bug A bug report hacktoberfest See https://hacktoberfest.digitalocean.com/ for participants details need script to reproduce Script is required to reproduce the issue status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants