Zend Framework

Zend Stange behaviour....

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.9.3
  • Fix Version/s: 1.10.0
  • Component/s: None
  • Labels:
    None

Description

Look like, when parameters are pass via URL (controller/action/var/value) and also via a post form, Zend execute action code twice? here is a simple sample:
<?php
/* buggyAction in controller/IndexController.php */
public function buggyAction() {
// a Form with just one submit button....cool
$form = new Zend_Form;
$signin = $form->createElement ( 'submit', 'signin' );
$signin->setvalue ( 'OK' );
$form->addElements ( array ($signin));

/* Action : if post : show param value

  • else : show 'No parameter' AND write a small file /tmp/buggyZF
    */
    if($this->getRequest()->isPost() ) { echo " Parameter = ".$this->_request->getParam ( 'value' ); }else{ system ('echo titi > /tmp/buggyZF'); echo "No Parameter"; }
    // Set the form to the view
    $this->view->form=$form;
    }
    -----------------------

Now go to http://mysite/index/buggy/value/12
you will see a submit button and 'No Parameter ' also the file /tmp/buggyZF has been created .... This is normal as there were not POST datas...
please remove the /tmp/buggyZF
Now just click on the [signin] button ..
you will see a submit button and 'Parameter = 12', which is completly normal as datas have been posted by the form... BUT the /tmp/buggyZF exist again !!! ???? which mean that the program has executed system ('echo titi > /tmp/buggyZF');

Try also:
go to http://mysite/index/buggy/
then remove /tmp/buggyZF (which has been normally created) ... and click on submit .... There is no bug (the /tmp/buggyZF is not created)....
go to http://mysite/index/buggy/bar/12
then remove /tmp/buggyZF (which has been normally created) ... and click on submit .... The bug is here : the /tmp/buggyZF has been created !

Do you think's it's normal ??? Why ?? Or is it a ZF bug??

See also : http://forums.zend.com/viewtopic.php?f=69&t=3989

Activity

Hide
Dolf Schimmel (Freeaqingme) added a comment -

Using the following code I was not able to reproduce the issue. You can be (pretty) sure this is not a bug in ZF as for then a lot of people would be suffering from it and notice it as well. It may be an issue with your javascript (if any), or maybe someone else is visiting that page at the same moment as you are?

$form = new Zend_Form();
        $signin = $form->createElement('submit', 'signin');
        $signin->setvalue('OK');
        $form->addElements(array($signin));
        /* Action : if post : show param value
        
            * else : show 'No parameter' AND write a small file /tmp/buggyZF
              */
        if ($this->getRequest()->isPost()) {
            echo " Parameter = " . $this->_request->getParam('value');
        } else {
            system('echo titi > /tmp/buggyZF');
            echo "No Parameter";
        }
        // Set the form to the view
        $this->view->form = $form;

Closing as cannot reproduce.

Show
Dolf Schimmel (Freeaqingme) added a comment - Using the following code I was not able to reproduce the issue. You can be (pretty) sure this is not a bug in ZF as for then a lot of people would be suffering from it and notice it as well. It may be an issue with your javascript (if any), or maybe someone else is visiting that page at the same moment as you are?
$form = new Zend_Form();
        $signin = $form->createElement('submit', 'signin');
        $signin->setvalue('OK');
        $form->addElements(array($signin));
        /* Action : if post : show param value
        
            * else : show 'No parameter' AND write a small file /tmp/buggyZF
              */
        if ($this->getRequest()->isPost()) {
            echo " Parameter = " . $this->_request->getParam('value');
        } else {
            system('echo titi > /tmp/buggyZF');
            echo "No Parameter";
        }
        // Set the form to the view
        $this->view->form = $form;
Closing as cannot reproduce.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: