Development

/branches/1.2/lib/action/sfActions.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/action/sfActions.class.php

Revision 19911, 1.9 kB (checked in by FabianLange, 5 years ago)

[1.0, 1.1, 1.2, 1.3] added check in sfActions that prefents infinite recursion in the execute method when the action name is empty (fixes #6710)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Rev Date
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  * (c) 2004-2006 Sean Kerr <sean@code-box.org>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 /**
13  * sfActions executes all the logic for the current request.
14  *
15  * @package    symfony
16  * @subpackage action
17  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
18  * @author     Sean Kerr <sean@code-box.org>
19  * @version    SVN: $Id$
20  */
21 abstract class sfActions extends sfAction
22 {
23   /**
24    * Dispatches to the action defined by the 'action' parameter of the sfRequest object.
25    *
26    * This method try to execute the executeXXX() method of the current object where XXX is the
27    * defined action name.
28    *
29    * @param sfRequest $request The current sfRequest object
30    *
31    * @return string    A string containing the view name associated with this action
32    *
33    * @throws sfInitializationException
34    *
35    * @see sfAction
36    */
37   public function execute($request)
38   {
39     // dispatch action
40     $actionToRun = 'execute'.ucfirst($this->getActionName());
41
42     if ($actionToRun === 'execute')
43     {
44       // no action given
45       throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s". There was no action given.', $this->getModuleName()));
46     }
47
48     if (!is_callable(array($this, $actionToRun)))
49     {
50       // action not found
51       throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s", action "%s". You must create a "%s" method.', $this->getModuleName(), $this->getActionName(), $actionToRun));
52     }
53
54     if (sfConfig::get('sf_logging_enabled'))
55     {
56       $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Call "%s->%s()"', get_class($this), $actionToRun))));
57     }
58
59     // run action
60     return $this->$actionToRun($request);
61   }
62 }
63
Note: See TracBrowser for help on using the browser.