PageRenderTime 24ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Group-I/jobeet/lib/vendor/symfony/lib/exception/sfError404Exception.class.php

https://bitbucket.org/hosseinzolfi/db-lab-spring-2011/
PHP | 52 lines | 27 code | 6 blank | 19 comment | 3 complexity | 6dd68b0acc77257ee70a54ca8f786250 MD5 | raw file
Possible License(s): ISC, AGPL-3.0, LGPL-2.1, BSD-3-Clause, LGPL-3.0
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * sfError404Exception is thrown when a 404 error occurs in an action.
  11. *
  12. * @package symfony
  13. * @subpackage exception
  14. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  15. * @version SVN: $Id: sfError404Exception.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
  16. */
  17. class sfError404Exception extends sfException
  18. {
  19. /**
  20. * Forwards to the 404 action.
  21. */
  22. public function printStackTrace()
  23. {
  24. $exception = null === $this->wrappedException ? $this : $this->wrappedException;
  25. if (sfConfig::get('sf_debug'))
  26. {
  27. $response = sfContext::getInstance()->getResponse();
  28. if (null === $response)
  29. {
  30. $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher());
  31. sfContext::getInstance()->setResponse($response);
  32. }
  33. $response->setStatusCode(404);
  34. return parent::printStackTrace();
  35. }
  36. else
  37. {
  38. // log all exceptions in php log
  39. if (!sfConfig::get('sf_test'))
  40. {
  41. error_log($this->getMessage());
  42. }
  43. sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action'));
  44. }
  45. }
  46. }