【问题标题】:Problems with zend, call to undefined function libxmlzend 的问题,调用未定义的函数 libxml
【发布时间】:2014-05-15 00:21:00
【问题描述】:

我开始使用 zend 框架并尝试提交表单时收到以下错误消息: 致命错误:在第 85 行调用 /usr/local/ZendFramework/library/Zend/Xml/Security.php 中未定义的函数 libxml_disable_entity_loader()

谁可以帮助我,我提前谢谢你。 :)

控制器.php

public function addAction()
{
    $this->view->title = "Agregar album";
    $this->view->headTitle($this->view->title);
    $form = new Application_Form_Album ();
    $form->submit->setLabel('Agregar Album');
    $this->view->form = $form;

    if ($this->getRequest()->isPost())
    {
        $formData = $this->getRequest()->getPost();

        if ($form->isValid($formData))
        {
            $artista_id = $form->getValue('artista_id');
            $nombre = $form->getValue('nombre');
            $fecha = $form->getValue('fecha');
            $descripcion = $form->getValue('descripcion');

            $fecha = $this->fechaMysql($fecha);

            $albums = new Application_Model_DbTable_Album ();

            $albums->agregar($artista_id, $nombre, $fecha, $descripcion);

            $this->_helper->redirector('index');
        }
        else
        {
            $form->populate($formData);
        }
    }
}

Form.php

<?php

class Application_Form_Album extends Zend_Form
{

    public function init()
    {
        $this->setName('albums');

        $id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');

        $nombre = new Zend_Form_Element_Text('nombre');
        $nombre->setLabel('Nombre del album:')->setRequired(true)->
            addFilter('StripTags')->addFilter('StringTrim')->
            addValidator('NotEmpty');

        $artista = new Zend_Form_Element_Select('artista_id');
        $artista->setLabel('Seleccione artista:')->setRequired(true);

        $table = new Application_Model_DbTable_Artista();

        foreach ($table->listar() as $c)
        {
            $artista->addMultiOption($c->id, $c->nombre);
        }

        $descripcion = new Zend_Form_Element_Text('descripcion');
        $descripcion->setLabel('Descripcion:')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');

        $fecha = new Zend_Form_Element_Text('fecha');
        $fecha->setLabel('Fecha lanzamiento:')->setRequired(true)->addFilter('StripTags')->
            addFilter('StringTrim')->addValidator('NotEmpty');
        $valiDate = new Zend_Validate_Date();
        $valiDate->setFormat('dd-mm-YYYY');
        $fecha->addValidator($valiDate);
        $fecha->setValue(date("d-m-Y"));

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');

        $this->addElements(array($id, $nombre,
            $artista, $descripcion, $fecha, $submit));
}

}

查看.phtml

<div class="formContainer">
    <?php echo $this->form ?>
</div>

【问题讨论】:

  • 您可能希望发布堆栈跟踪的其余部分,以便为您尝试做的事情提供更多背景信息。
  • @Luke 已经更新我的帖子了。
  • 如果您使用 ZF 1.12 或更高版本,您可能需要至少更新到 5.2.11。请参阅下面的答案。
  • 你怎么称呼这个控制器?你在使用路线吗?
  • /var/www/zend/practone/application/controllers/AlbumCotroller.php

标签: php zend-framework


【解决方案1】:

我怀疑这是你的问题:http://framework.zend.com/issues/browse/ZF-12442

【讨论】:

  • 我的版本是 PHP 5.2.10
  • 你用的是什么版本的ZF?
  • 那么上面链接中描述的问题似乎也是你的问题。看来您需要将 ZF 降级到 1.11 或升级到 PHP 5.2.11 或更高版本。我会升级 PHP,因为 ZF 1.12 与旧版本的 PHP 不兼容似乎是由于安全修复。
猜你喜欢
  • 2011-12-23
  • 2017-04-17
  • 2018-07-21
  • 1970-01-01
  • 2016-10-22
  • 1970-01-01
  • 1970-01-01
  • 2018-04-27
  • 2021-11-14
相关资源
最近更新 更多