Edit report at http://bugs.php.net/bug.php?id=51187&edit=1

 ID:               51187
 Updated by:       ahar...@php.net
 Reported by:      bostjan at a2o dot si
 Summary:          Segmentation fault with Zend_Form/Zend_View
-Status:           Open
+Status:           Feedback
 Type:             Bug
 Package:          Reproducible crash
 Operating System: Linux
 PHP Version:      Irrelevant

 New Comment:

You can find instructions on generating a backtrace at
http://bugs.php.net/bugs-

generating-backtrace.php.


Previous Comments:
------------------------------------------------------------------------
[2010-03-03 04:54:52] ahar...@php.net

-Status: Open
+Status: Feedback


------------------------------------------------------------------------
[2010-03-03 04:33:33] bostjan at a2o dot si

It most certainly is an endless recursion, though it should only lead to
memory limit error.



How do I acquire a stack track?

------------------------------------------------------------------------
[2010-03-03 00:37:52] johan...@php.net

I assume this is an endless recursion, can you please provide a
stacktrack?

------------------------------------------------------------------------
[2010-03-03 00:37:51] johan...@php.net

-Status: Open
+Status: Feedback


------------------------------------------------------------------------
[2010-03-03 00:32:33] bostjan at a2o dot si

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 this bug report at http://bugs.php.net/bug.php?id=51187&edit=1

Reply via email to