本文整理汇总了PHP中xdebug_is_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_is_enabled函数的具体用法?PHP xdebug_is_enabled怎么用?PHP xdebug_is_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdebug_is_enabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkXDebug
/**
* @throws \RuntimeException
*/
protected function checkXDebug()
{
if (extension_loaded('xdebug') && xdebug_is_enabled() && ini_get('xdebug.max_nesting_level') < 200) {
$errorMessage = 'Please change PHP ini setting "xdebug.max_nesting_level". ' . 'Please change it to a value >= 200. ' . 'Your current value is ' . ini_get('xdebug.max_nesting_level');
throw new \RuntimeException($errorMessage);
}
}
示例2: xdebugIsEnabled
public static function xdebugIsEnabled()
{
if (extension_loaded('xdebug')) {
return (bool) xdebug_is_enabled();
}
return false;
}
示例3: _before
public function _before(\Codeception\TestCase $test)
{
if (!$this->client) {
if (!strpos($this->config['url'], '://')) {
// not valid url
foreach ($this->getModules() as $module) {
if ($module instanceof \Codeception\Lib\Framework) {
$this->client = $module->client;
$this->isFunctional = true;
break;
}
}
} else {
if (!$this->hasModule('PhpBrowser')) {
throw new ModuleConfigException(__CLASS__, "For REST testing via HTTP please enable PhpBrowser module");
}
$this->client = $this->getModule('PhpBrowser')->client;
}
if (!$this->client) {
throw new ModuleConfigException(__CLASS__, "Client for REST requests not initialized.\nProvide either PhpBrowser module, or a framework module which shares FrameworkInterface");
}
}
$this->headers = array();
$this->params = array();
$this->response = "";
$this->client->setServerParameters(array());
if ($this->config['xdebug_remote'] && function_exists('xdebug_is_enabled') && xdebug_is_enabled() && ini_get('xdebug.remote_enable') && !$this->isFunctional) {
$cookie = new Cookie('XDEBUG_SESSION', $this->config['xdebug_remote'], null, '/');
$this->client->getCookieJar()->set($cookie);
}
}
示例4: traceStop
function traceStop()
{
if (!function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) {
return;
}
xdebug_stop_trace();
}
示例5: isXdebugActive
/**
* XDebug Helper Functions.
*/
public static function isXdebugActive()
{
if (extension_loaded('xdebug') and xdebug_is_enabled()) {
return true;
}
return false;
}
示例6: _initialize
/**
* Initializes the default configuration for the object
*
* Called from {@link __construct()} as a first step of object instantiation.
*
* @param KObjectConfig $config An optional ObjectConfig object with configuration options.
* @return void
*/
protected function _initialize(KObjectConfig $config)
{
if (extension_loaded('xdebug') && xdebug_is_enabled() && getenv('JOOMLATOOLS_BOX')) {
$level = self::ERROR_DEVELOPMENT;
$type = self::TYPE_ALL;
} else {
$level = JDEBUG ? E_ERROR | E_PARSE : self::ERROR_REPORTING;
$type = JDEBUG ? self::TYPE_ALL : false;
}
$config->append(array('exception_type' => $type, 'error_reporting' => $level));
parent::_initialize($config);
}
示例7: soapclient
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();
}
}
示例8: _before
public function _before(\Codeception\TestCase $test)
{
if (!$this->client) {
if (!strpos($this->config['url'], '://')) {
// not valid url
foreach ($this->getModules() as $module) {
if ($module instanceof \Codeception\Util\Framework) {
$this->client = $module->client;
$this->is_functional = true;
break;
}
}
} else {
if (!$this->hasModule('PhpBrowser')) {
throw new ModuleConfigException(__CLASS__, "For REST testing via HTTP please enable PhpBrowser module");
}
$this->client = $this->getModule('PhpBrowser')->session->getDriver()->getClient();
}
if (!$this->client) {
throw new ModuleConfigException(__CLASS__, "Client for REST requests not initialized.\nProvide either PhpBrowser module, or a framework module which shares FrameworkInterface");
}
}
$this->headers = array();
$this->params = array();
$this->response = "";
$this->client->setServerParameters(array());
$timeout = $this->config['timeout'];
if ($this->config['xdebug_remote'] && function_exists('xdebug_is_enabled') && xdebug_is_enabled() && ini_get('xdebug.remote_enable')) {
$cookie = new Cookie('XDEBUG_SESSION', $this->config['xdebug_remote'], null, '/');
$this->client->getCookieJar()->set($cookie);
// timeout is disabled, so we can debug gently :)
$timeout = 0;
}
if (method_exists($this->client, 'getClient')) {
$clientConfig = $this->client->getClient()->getConfig();
$curlOptions = $clientConfig->get('curl.options');
$curlOptions[CURLOPT_TIMEOUT] = $timeout;
$clientConfig->set('curl.options', $curlOptions);
}
}
示例9: __construct
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()));
}
}
示例10: checkDeprecatedAttributes
/**
* Checks for deprecated attributes and warns the developer - only displays a
* message if debugging is enabled.
*
* @see http://dev.w3.org/html5/html4-differences/#absent-attributes
*/
protected static function checkDeprecatedAttributes($tag, $attrs)
{
$deprecated[RenderContext::LANG_HTML]['5'] = array('a' => array('charset', 'coords', 'rev', 'shape'), 'area' => array('nohref'), 'body' => array('alink', 'background', 'bgcolor', 'link', 'text', 'vlink'), 'br' => array('clear'), 'caption' => array('align'), 'col' => array('align', 'char', 'charoff', 'valign', 'width'), 'colgroup' => array('align', 'char', 'charoff', 'valign', 'width'), 'div' => array('align'), 'dl' => array('compact'), 'h1' => array('align'), 'h2' => array('align'), 'h3' => array('align'), 'h4' => array('align'), 'h5' => array('align'), 'h6' => array('align'), 'head' => array('profile'), 'hr' => array('align', 'noshade', 'size', 'width'), 'html' => array('version'), 'iframe' => array('align', 'frameborder', 'marginheight', 'longdesc', 'marginwidth', 'scrolling'), 'img' => array('align', 'hspace', 'longdesc', 'name', 'vspace'), 'input' => array('align'), 'legend' => array('align'), 'li' => array('type'), 'link' => array('charset', 'rev', 'target'), 'menu' => array('compact'), 'meta' => array('scheme'), 'object' => array('align', 'archive', 'border', 'classid', 'codebase', 'codetype', 'declare', 'hspace', 'standby', 'vspace'), 'ol' => array('compact', 'type'), 'p' => array('align'), 'param' => array('type', 'valuetype'), 'pre' => array('width'), 'table' => array('align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'frame', 'rules', 'width'), 'tbody' => array('align', 'char', 'charoff', 'valign'), 'td' => array('abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'height', 'nowrap', 'scope', 'valign', 'width'), 'tfoot' => array('align', 'char', 'charoff', 'valign'), 'th' => array('abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'height', 'nowrap', 'valign', 'width'), 'thead' => array('align', 'char', 'charoff', 'valign'), 'tr' => array('align', 'bgcolor', 'char', 'charoff', 'valign'), 'ul' => array('compact', 'type'));
$deprecated[RenderContext::LANG_XHTML]['5'] =& $deprecated[RenderContext::LANG_HTML]['5'];
$ctx = RenderContext::get();
$x = $deprecated;
if (array_key_exists($ctx->getLanguage(), $x)) {
$x = $x[$ctx->getLanguage()];
if (array_key_exists("{$ctx->getVersion()}", $x)) {
$x = $x[$ctx->getVersion()];
if (in_array($tag, array_keys($x))) {
$x = $x[$tag];
foreach ($attrs as $a) {
if (!in_array($a, $x)) {
continue;
}
$restore_xdebug = false;
if (extension_loaded('xdebug')) {
$restore_xebug = xdebug_is_enabled();
# A complete stack trace is overkill for a deprecation error
xdebug_disable();
}
trigger_error("'{$tag}[{$a}]' is deprecated or removed in {$ctx->getLanguage()} {$ctx->getVersion()}", E_USER_DEPRECATED);
if ($restore_xdebug) {
xdebug_enable();
}
}
}
}
}
}
示例11: connect
/**
* connect to the database; returns Doctrine connection
*
* @access public
* @return object
**/
public static function connect($opt = array())
{
self::setExceptionHandler();
if (!self::$conn) {
$config = new \Doctrine\DBAL\Configuration();
$config->setSQLLogger(new Doctrine\DBAL\Logging\DebugStack());
if (!defined('CAT_DB_NAME') && file_exists(dirname(__FILE__) . '/../../../config.php')) {
include dirname(__FILE__) . '/../../../config.php';
}
$connectionParams = array('charset' => 'utf8', 'driver' => 'pdo_mysql', 'dbname' => isset($opt['DB_NAME']) ? $opt['DB_NAME'] : CAT_DB_NAME, 'host' => isset($opt['DB_HOST']) ? $opt['DB_HOST'] : CAT_DB_HOST, 'password' => isset($opt['DB_PASSWORD']) ? $opt['DB_PASSWORD'] : CAT_DB_PASSWORD, 'user' => isset($opt['DB_USERNAME']) ? $opt['DB_USERNAME'] : CAT_DB_USERNAME, 'port' => isset($opt['DB_PORT']) ? $opt['DB_PORT'] : CAT_DB_PORT);
if (function_exists('xdebug_is_enabled')) {
$xdebug_state = xdebug_is_enabled();
} else {
$xdebug_state = false;
}
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
try {
self::$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
} catch (\PDO\PDOException $e) {
$this->setError($e->message);
CAT_Object::printFatalError($e->message);
}
if (function_exists('xdebug_enable') && $xdebug_state) {
xdebug_enable();
}
}
self::restoreExceptionHandler();
return self::$conn;
}
示例12: __construct
protected final function __construct()
{
// Turn error reporting off as it is displayed in debugger mode only!
ini_set('display_errors', false);
// Show ALL errors & notices
error_reporting(E_ALL ^ E_NOTICE);
ini_set('ignore_repeated_errors', true);
ini_set('ignore_repeated_source', true);
// Enable HTML Error messages
ini_set('html_errors', true);
ini_set('docref_root', 'http://docs.php.net/manual/en/');
ini_set('docref_ext', '.php');
// Define the Error & Exception handlers
set_error_handler(array(&$this, 'errorLogger'), ini_get('error_reporting'));
set_exception_handler(array(&$this, 'exceptionHandler'));
// Enable debugger
if (isset($GLOBALS['config']) && is_object($GLOBALS['config'])) {
$this->_enabled = (bool) $GLOBALS['config']->get('config', 'debug');
$ip_string = $GLOBALS['config']->get('config', 'debug_ip_addresses');
if (!empty($ip_string)) {
if (strstr($ip_string, ',')) {
$ip_addresses = explode(',', $ip_string);
if (!in_array(get_ip_address(), $ip_addresses)) {
$this->_enabled = false;
}
} else {
if ($ip_string !== get_ip_address()) {
$this->_enabled = false;
}
}
}
}
//If its time to clear the cache
if (isset($_GET['debug-cache-clear'])) {
$GLOBALS['cache']->clear();
$GLOBALS['cache']->tidy();
httpredir(currentPage(array('debug-cache-clear')));
}
//Check for xdebug
if (extension_loaded('xdebug') && function_exists('xdebug_is_enabled')) {
$this->_xdebug = xdebug_is_enabled();
}
$this->_debug_timer = $this->_getTime();
// Check register_globals
if (ini_get('register_globals')) {
trigger_error('register_globals are enabled. It is highly recommended that you disable this in your PHP configuration, as it is a large security hole, and may wreak havoc.', E_USER_WARNING);
}
Sanitize::cleanGlobals();
}
示例13: extension_loaded
">
<?php
echo $core_lang->get_value($lang_order[0]);
?>
</div>
)
</span>
<span class="labs-platform"><?php
echo $lang->running_on(CORE_TITLE, CORE_VERSION, PHP_VERSION);
?>
</span>
</div>
</div>
<?php
$xdebug_enabled = extension_loaded('xdebug') && xdebug_is_enabled();
?>
<div id="content">
<div class="content">
<ul id="toolbar">
<li data-href=""><?php
echo $lang->button_run;
?>
</li>
<?php
if ($xdebug_enabled) {
$extra_class = isset($_GET['class']) ? 'class=' . urlencode($_GET['class']) . '&' : null;
?>
<li data-href="?<?php
echo $extra_class;
示例14: die
if (!class_exists('SemanticMediaWiki') || ($version = SemanticMediaWiki::getVersion()) === null) {
die("\\Semantic MediaWiki is not available, please check your LocalSettings or Composer settings.\n");
}
// @codingStandardsIgnoreStart phpcs, ignore --sniffs=Generic.Files.LineLength.MaxExceeded
print sprintf("\n%-20s%s\n", "Semantic MediaWiki:", $version . ' (' . implode(', ', SemanticMediaWiki::getEnvironment()) . ')');
// @codingStandardsIgnoreEnd
if (is_readable($path = __DIR__ . '/../vendor/autoload.php')) {
print sprintf("%-20s%s\n", "MediaWiki:", $GLOBALS['wgVersion'] . " (Extension vendor autoloader)");
} elseif (is_readable($path = __DIR__ . '/../../../vendor/autoload.php')) {
print sprintf("%-20s%s\n", "MediaWiki:", $GLOBALS['wgVersion'] . " (MediaWiki vendor autoloader)");
} else {
die('To run tests it is required that packages are installed using Composer.');
}
print sprintf("%-20s%s\n", "Site language:", $GLOBALS['wgLanguageCode']);
$dateTimeUtc = new \DateTime('now', new \DateTimeZone('UTC'));
print sprintf("\n%-20s%s\n", "Execution time:", $dateTimeUtc->format('Y-m-d h:i'));
if (extension_loaded('xdebug') && xdebug_is_enabled()) {
print sprintf("%-20s%s\n\n", "Xdebug:", phpversion('xdebug') . ' (enabled)');
} else {
print sprintf("%-20s%s\n\n", "Xdebug:", 'Disabled (or not installed)');
}
/**
* Available to aid third-party extensions therefore any change should be made with
* care
*
* @since 2.0
*/
$autoloader = (require $path);
$autoloader->addPsr4('SMW\\Tests\\Utils\\', __DIR__ . '/phpunit/Utils');
$autoloader->addClassMap(array('SMW\\Tests\\TestEnvironment' => __DIR__ . '/phpunit/TestEnvironment.php', 'SMW\\Tests\\MwDBaseUnitTestCase' => __DIR__ . '/phpunit/MwDBaseUnitTestCase.php', 'SMW\\Tests\\ByJsonTestCaseProvider' => __DIR__ . '/phpunit/ByJsonTestCaseProvider.php', 'SMW\\Tests\\JsonTestCaseFileHandler' => __DIR__ . '/phpunit/JsonTestCaseFileHandler.php', 'SMW\\Test\\QueryPrinterTestCase' => __DIR__ . '/phpunit/QueryPrinterTestCase.php', 'SMW\\Test\\QueryPrinterRegistryTestCase' => __DIR__ . '/phpunit/QueryPrinterRegistryTestCase.php'));
return $autoloader;
示例15: getTrace
/**
* Gets the backgrace from an exception.
*
* If xdebug is installed
*
* @param Exception $e
* @return array
*/
protected function getTrace(\Exception $e)
{
$traces = $e->getTrace();
// Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default
if (!$e instanceof \ErrorException) {
return $traces;
}
if (!Misc::isLevelFatal($e->getSeverity())) {
return $traces;
}
if (!extension_loaded('xdebug') || !xdebug_is_enabled()) {
return array();
}
// Use xdebug to get the full stack trace and remove the shutdown handler stack trace
$stack = array_reverse(xdebug_get_function_stack());
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$traces = array_diff_key($stack, $trace);
return $traces;
}