From:             
Operating system: Linux
PHP version:      Irrelevant
Package:          Reproducible crash}
Bug Type:         Bug
Bug description:Segmentation fault with Zend_Form/Zend_View

Description:
------------
If I accidentally pass a wrong parameter to Zend_Form when creating a new
element

(common mistake during development) and I pass an element itself, it causes
segmentation fault.



I don't have time to investigate this issue further to pinpoint exact
location of segfault in Zend Framework, therefore I am attaching only proof
of concept code below, which uses Zend Framework classes.



Test script:
---------------
// Enable Zend Autoloader

require_once "Zend/Loader/Autoloader.php";

$autoloader = Zend_Loader_Autoloader::getInstance();





// Get form object

$domain = 'a2o.si';

$Form   = _getForm($domain);

echo $Form->render();







// Function that creates form object

function _getForm ($domain)

{

    $View = new Zend_View();



    // Create form

    $Form = new Zend_Form();

    $Form->setView($View);

    $Form->setAction('/domain/createrr')

        ->setMethod('post')

        ->setName('form_createrr');



    // Add an element - NOTE A BUGGY WAY TO ADD IT 

    // ($domain is not 'a2o.si' anymore after this line)

    $domain = $Form->createElement('hidden', 'domain');

    $domain->setValue($domain);

    $Form->addElement($domain);



    return $Form;

}



Expected result:
----------------
Form in HTML notation.

Actual result:
--------------
Segmentation fault (tested with CLI and Apache Handler)



-- 
Edit bug report at http://bugs.php.net/bug.php?id=51187&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51187&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51187&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51187&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51187&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51187&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51187&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51187&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51187&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51187&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51187&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51187&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51187&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51187&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51187&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51187&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51187&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51187&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51187&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51187&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51187&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51187&r=mysqlcfg

Reply via email to