当前位置: 首页>>代码示例>>PHP>>正文


PHP sfException::printStackTrace方法代码示例

本文整理汇总了PHP中sfException::printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:PHP sfException::printStackTrace方法的具体用法?PHP sfException::printStackTrace怎么用?PHP sfException::printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfException的用法示例。


在下文中一共展示了sfException::printStackTrace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dispatch

 /**
  * Dispatches a request.
  *
  * This will determine which module and action to use by request parameters specified by the user.
  */
 public function dispatch()
 {
     try {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->getContext()->getLogger()->info('{sfController} dispatch request');
         }
         // reinitialize filters (needed for unit and functional tests)
         sfFilter::$filterCalled = array();
         // determine our module and action
         $request = $this->getContext()->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         $e->printStackTrace();
     } catch (Exception $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         try {
             // wrap non symfony exceptions
             $sfException = new sfException();
             $sfException->printStackTrace($e);
         } catch (Exception $e) {
             header('HTTP/1.0 500 Internal Server Error');
         }
     }
 }
开发者ID:taryono,项目名称:school,代码行数:37,代码来源:sfFrontWebController.class.php

示例2: printStackTrace

  /**
   * Forwards to the 404 action.
   */
  public function printStackTrace()
  {
    $exception = null === $this->wrappedException ? $this : $this->wrappedException;

    if (sfConfig::get('sf_debug'))
    {
      $response = sfContext::getInstance()->getResponse();
      if (null === $response)
      {
        $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher());
        sfContext::getInstance()->setResponse($response);
      }

      $response->setStatusCode(404);

      return parent::printStackTrace();
    }
    else
    {
      // log all exceptions in php log
      if (!sfConfig::get('sf_test'))
      {
        error_log($this->getMessage());
      }

      sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action'));
    }
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:sfError404Exception.class.php

示例3: printStackTrace

 /**
  * Forwards to the error action.
  */
 public function printStackTrace()
 {
     $exception = is_null($this->wrappedException) ? $this : $this->wrappedException;
     if (sfConfig::get('sf_debug')) {
         $response = sfContext::getInstance()->getResponse();
         if (is_null($response)) {
             $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher());
             sfContext::getInstance()->setResponse($response);
         }
         $response->setStatusCode($this->httpStatusCode);
         return sfException::printStackTrace();
         // skip sfError404Exception::printStackTrace()
     } else {
         // log all exceptions in php log
         if (!sfConfig::get('sf_test')) {
             error_log($this->getMessage());
         }
         if ($this->getMessage()) {
             sfContext::getInstance()->getRequest()->setParameter('error_message', $this->getMessage());
         }
         $module = sfConfig::get('sf_error_' . $this->httpStatusCode . '_module', sfConfig::get('sf_error_404_module', 'default'));
         $action = sfConfig::get('sf_error_' . $this->httpStatusCode . '_action', sfConfig::get('sf_error_404_action', 'error'));
         sfContext::getInstance()->getController()->forward($module, $action);
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:28,代码来源:opErrorHttpException.class.php

示例4: dispatch

 /**
  * Dispatches a request.
  *
  * @param string A module name
  * @param string An action name
  * @param array  An associative array of parameters to be set
  */
 public function dispatch($moduleName, $actionName, $parameters = array())
 {
     try {
         // set parameters
         $this->getContext()->getRequest()->getParameterHolder()->add($parameters);
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         // wrap non symfony exceptions
         $sfException = new sfException();
         $sfException->printStackTrace($e);
     }
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:22,代码来源:sfConsoleController.class.php

示例5: dispatch

 public function dispatch()
 {
     try {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->getContext()->getLogger()->info('{sfController} dispatch request');
         }
         sfFilter::$filterCalled = array();
         $request = $this->getContext()->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         $e->printStackTrace();
     } catch (Exception $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         try {
             $sfException = new sfException($e->getMessage());
             $sfException->printStackTrace($e);
         } catch (Exception $e) {
             header('HTTP/1.0 500 Internal Server Error');
         }
     }
 }
开发者ID:kotow,项目名称:work,代码行数:28,代码来源:config_core_compile.yml.php

示例6: catch

    error_reporting(sfConfig::get('sf_error_reporting'));
    // create bootstrap file for next time
    if (!sfConfig::get('sf_in_bootstrap') && !$sf_debug && !sfConfig::get('sf_test')) {
        $configCache->checkConfig($sf_app_config_dir_name . '/bootstrap_compile.yml');
    }
    // required core classes for the framework
    // create a temp var to avoid substitution during compilation
    if (!$sf_debug && !sfConfig::get('sf_test')) {
        $core_classes = $sf_app_config_dir_name . '/core_compile.yml';
        $configCache->import($core_classes, false);
    }
    $configCache->import($sf_app_config_dir_name . '/php.yml', false);
    $configCache->import($sf_app_config_dir_name . '/routing.yml', false);
    // include all config.php from plugins
    sfLoader::loadPluginConfig();
    // compress output
    ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');
} catch (sfException $e) {
    $e->printStackTrace();
} catch (Exception $e) {
    if (sfConfig::get('sf_test')) {
        throw $e;
    }
    try {
        // wrap non symfony exceptions
        $sfException = new sfException();
        $sfException->printStackTrace($e);
    } catch (Exception $e) {
        header('HTTP/1.0 500 Internal Server Error');
    }
}
开发者ID:taryono,项目名称:school,代码行数:31,代码来源:symfony.php

示例7: call

 public function call($uri, $method = 'get', $parameters = array(), $changeStack = true)
 {
     $uri = $this->fixUri($uri);
     // add uri to the stack
     if ($changeStack) {
         $this->stack = array_slice($this->stack, 0, $this->stackPosition + 1);
         $this->stack[] = array('uri' => $uri, 'method' => $method, 'parameters' => $parameters);
         $this->stackPosition = count($this->stack) - 1;
     }
     list($path, $query_string) = false !== ($pos = strpos($uri, '?')) ? array(substr($uri, 0, $pos), substr($uri, $pos + 1)) : array($uri, '');
     $query_string = html_entity_decode($query_string);
     // remove anchor
     $path = preg_replace('/#.*/', '', $path);
     // removes all fields from previous request
     $this->fields = array();
     // prepare the request object
     $_SERVER = $this->defaultServerArray;
     $_SERVER['HTTP_HOST'] = $this->hostname ? $this->hostname : sfConfig::get('sf_app') . '-' . sfConfig::get('sf_environment');
     $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST'];
     $_SERVER['SERVER_PORT'] = 80;
     $_SERVER['HTTP_USER_AGENT'] = 'PHP5/CLI';
     $_SERVER['REMOTE_ADDR'] = $this->remote ? $this->remote : '127.0.0.1';
     $_SERVER['REQUEST_METHOD'] = strtoupper($method);
     $_SERVER['PATH_INFO'] = $path;
     $_SERVER['REQUEST_URI'] = '/index.php' . $uri;
     $_SERVER['SCRIPT_NAME'] = '/index.php';
     $_SERVER['SCRIPT_FILENAME'] = '/index.php';
     $_SERVER['QUERY_STRING'] = $query_string;
     foreach ($this->vars as $key => $value) {
         $_SERVER[strtoupper($key)] = $value;
     }
     // request parameters
     $_GET = $_POST = array();
     if (strtoupper($method) == 'POST') {
         $_POST = $parameters;
     }
     if (strtoupper($method) == 'GET') {
         $_GET = $parameters;
     }
     parse_str($query_string, $qs);
     if (is_array($qs)) {
         $_GET = array_merge($qs, $_GET);
     }
     // restore cookies
     $_COOKIE = array();
     foreach ($this->cookieJar as $name => $cookie) {
         $_COOKIE[$name] = $cookie['value'];
     }
     // recycle our context object
     sfContext::removeInstance();
     $this->context = sfContext::getInstance();
     // launch request via controller
     $controller = $this->context->getController();
     $request = $this->context->getRequest();
     $response = $this->context->getResponse();
     // we register a fake rendering filter
     sfConfig::set('sf_rendering_filter', array('sfFakeRenderingFilter', null));
     $this->currentException = null;
     // dispatch our request
     ob_start();
     try {
         $controller->dispatch();
     } catch (sfException $e) {
         $this->currentException = $e;
         $e->printStackTrace();
     } catch (Exception $e) {
         $this->currentException = $e;
         $sfException = new sfException();
         $sfException->printStackTrace($e);
     }
     $retval = ob_get_clean();
     if ($this->currentException instanceof sfStopException) {
         $this->currentException = null;
     }
     // append retval to the response content
     $response->setContent($retval);
     // manually shutdown user to save current session data
     $this->context->getUser()->shutdown();
     $this->context->getStorage()->shutdown();
     // save cookies
     $this->cookieJar = array();
     foreach ($response->getCookies() as $name => $cookie) {
         // FIXME: deal with expire, path, secure, ...
         $this->cookieJar[$name] = $cookie;
     }
     // for HTML/XML content, create a DOM and sfDomCssSelector objects for the response content
     if (preg_match('/(x|ht)ml/i', $response->getContentType())) {
         $this->dom = new DomDocument('1.0', sfConfig::get('sf_charset'));
         $this->dom->validateOnParse = true;
         @$this->dom->loadHTML($response->getContent());
         $this->domCssSelector = new sfDomCssSelector($this->dom);
     }
     return $this;
 }
开发者ID:DBezemer,项目名称:server,代码行数:94,代码来源:sfBrowser.class.php


注:本文中的sfException::printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。