Shardj / zf1-future

PHP 8.1 compatible version of ZF1
BSD 3-Clause "New" or "Revised" License
440 stars 190 forks source link

Member function process() on null #418

Open tomasr1981 opened 4 months ago

tomasr1981 commented 4 months ago

Hi, I found an error that I can't locate, or rather I don't know what caused it. The truth is that I'm using PHP 8.2, but I'm not sure if that makes a difference.

I am using the following code in simple-template.tpl.php, yet the error says that there is an error on line 246.


<?php if (!is_null($this->actionScript)) : ?>
    <?php echo $this->render($this->actionScript); ?>
<?php endif; ?>
Call to a member function process() on null
#0 /www/doc/www.bryle-domu.cz/www/library/Zend/View.php(157): include()
#1 /www/doc/www.bryle-domu.cz/www/library/Zend/View/Abstract.php(886): Zend_View->_run('application/vie...')
#2 /www/doc/www.bryle-domu.cz/www/application/views/scripts/cs/_common/simple-template.tpl.php(246): Zend_View_Abstract->render(NULL)
#3 /www/doc/www.bryle-domu.cz/www/library/Zend/View.php(157): include('/www/doc/www.br...')
#4 /www/doc/www.bryle-domu.cz/www/library/Zend/View/Abstract.php(886): Zend_View->_run('application/vie...')
#5 /www/doc/www.bryle-domu.cz/www/library/Venturia/Controller/Action/Helper/SimpleTemplateViewRenderer.php(81): Zend_View_Abstract->render(NULL)
#6 /www/doc/www.bryle-domu.cz/www/library/Zend/Controller/Action/Helper/ViewRenderer.php(931): Venturia_Controller_Action_Helper_SimpleTemplateViewRenderer->renderScript('index/simple-pa...', NULL)
#7 /www/doc/www.bryle-domu.cz/www/library/Zend/Controller/Action/Helper/ViewRenderer.php(970): Zend_Controller_Action_Helper_ViewRenderer->render()
#8 /www/doc/www.bryle-domu.cz/www/library/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#9 /www/doc/www.bryle-domu.cz/www/library/Zend/Controller/Action.php(533): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#10 /www/doc/www.bryle-domu.cz/www/library/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('simplePageActio...')
#11 /www/doc/www.bryle-domu.cz/www/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#12 /www/doc/www.bryle-domu.cz/www/index.php(157): Zend_Controller_Front->dispatch()

What exactly causes the framework error and how can it be fixed?

rruchte commented 4 months ago

Venturia/Controller/Action/Helper/SimpleTemplateViewRenderer.php is not a Zend Framework class, but it looks like that's where the bug is. It is calling Zend_View_Abstract->render with a null argument, but the argument should be the name of a template file. ZF should probably throw an error in this case, but it does not, so you deal with the natural consequences of trying to render with a null template file name.

tomasr1981 commented 4 months ago

You're right, I forgot to mention that. However, this line is treated and the mentioned function should not be called with a null template.

80    if (!is_null($layoutScript)) {
81        $layoutContent = $this->view->render($layoutScript);
82        $this->getResponse()->appendBody($layoutContent, $name);
84    }

So listing the error doesn't make much sense. Do you have any idea?

rruchte commented 4 months ago

I would run that in a debugger and see what is actually happening, there is no way to tell from this, other than it's something unexpected.