Issues

ZF-12139: Segmentation Fault when rendering a Zend_Form_Element

Description

Please see https://bugs.php.net/bug.php?id=60158

Using ZendFramework-1.11.10. Seg fault occurs also in 5.3.2 as well as 5.3.8. Does not occur in 5.2.4. Difficult to reproduce, but I will include the gdb backtrace. Basically assigning the value of variable to another, causes the seg fault. I can not determine why. The line {{$this->_element = $element;}} causes the seg fault.


    public function setElement($element)
    {
        if ((!$element instanceof Zend_Form_Element)
            && (!$element instanceof Zend_Form)
            && (!$element instanceof Zend_Form_DisplayGroup))
        {
            require_once 'Zend/Form/Decorator/Exception.php';
            throw new Zend_Form_Decorator_Exception('Invalid element type passed to decorator');
        }

        $this->_element = $element;
        return $this;
    }

Not this: exit signal Segmentation fault (11)

Program terminated with signal 11, Segmentation fault.

They recommended I report this issue.

Any ideas how I can get around this? When I echo a form element sometimes I get a Segmentation fault, happens frequently when there is an input type of File.


class Form_ContactPhoto extends Form_Source
{
    public function init()
    {
        $this->addElement('hidden', 'ID');
        
        $element = new Zend_Form_Element_File('ContactPhoto');
        $element
            ->setLabel('New Photo')
            ->setDestination(TMP_DIR)
            ->setRequired(false)
            ->addValidator('Count', false, 1)
            ->addValidator('Size', false, 10240000) // 10 mb max
            ->addValidator('Extension', false, 'jpg,png,gif')
            ->setDecorators(array('File'));
        $this->addElement($element);
        
        $this->addElement('text', 'MarketingPhotoBwLocation');
        
        $this->addElement('text', 'MarketingPhotoLocation');
        
        $this->addElement('submit', 'Submit', array('label' => 'Save'));
    }
}

Comments

Hi Michael, any update on this issue? Is this a problem from PHP or from Zend Framework? I can not reproduce the problem (PHP 5.3.6 and 5.3.10).

Can anyone reproduce the problem?

What is the value of your APPLICATION_PATH constant?

Yes APPLICATION_PATH is constant.

@Frank, yes this is still an issue for us. If you add blank new lines to the file it can sometimes cause the seg fault to not happen. Strange huh.

Please provide more information.

We cannot fix this without reproducing, and it seems to happen with very few systems... Please provide O/S distribution / version, php configure line and a complete, executable, minimal script to reproduce the problem.

I too face this problem.