本文整理汇总了PHP中xdebug_enable函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_enable函数的具体用法?PHP xdebug_enable怎么用?PHP xdebug_enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdebug_enable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoadVendorDatabaseBadMask
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']);
}
示例2: 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();
}
}
示例3: setEnabled
/**
* 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');
}
}
示例4: __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()));
}
}
示例5: check
/**
* 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();
}
}
示例6: initializeClient
/**
* Initializes Soap Client with WSDL and an options array
*
* @throws CouldNotConnectException
*/
protected function initializeClient()
{
// Store some specific soap-client related data locally
// so it can be injected in the SoapClient and compared
// for changes later
$this->wsdl = $this->request->getLocation();
$this->clientOptions = $this->request->getOptions();
// store hash to make it possible to detect changes to the client
$this->clientHash = $this->makeSoapClientHash();
$xdebugEnabled = extension_loaded('xdebug') && xdebug_is_enabled();
try {
// temporarily disable xdebug to prevent PHP Fatal error
// while constructing SoapClient
if ($xdebugEnabled) {
xdebug_disable();
}
$this->client = app($this->soapClientClass, [$this->wsdl, $this->clientOptions]);
if ($xdebugEnabled) {
xdebug_enable();
}
} catch (SoapFault $e) {
throw new CouldNotConnectException($e->getMessage(), $e->getCode(), $e);
} catch (Exception $e) {
throw new CouldNotConnectException($e->getMessage(), $e->getCode(), $e);
}
}
示例7: 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();
}
}
}
}
}
}
示例8: XDebug
public static function XDebug($enabled = true)
{
if (!function_exists('xdebug_enable')) {
return false;
}
if ($enabled) {
ini_set('xdebug.collect_vars', 'on');
ini_set('xdebug.collect_params', '1');
ini_set('xdebug.dump_globals', 'off');
ini_set('xdebug.dump.SERVER', 'REQUEST_URI');
ini_set('xdebug.show_local_vars', 'off');
xdebug_enable();
} else {
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
ini_set('xdebug.collect_vars', 'off');
ini_set('xdebug.collect_params', '0');
}
return true;
}
示例9: __call
/**
* 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;
}
示例10: get_connection
/**
* Connect to the web service and return the connection
*
* @since 0.1
* @throws SoapFault for the following conditions:
* Invalid username/password
* WSDL error/unavailable (note that XDebug must be disabled otherwise this becomes a un-catchable fatal. This can be done with xdebug_disable() followed by xdebug_enable() )
* @return SoapClient connection to the web service
*/
private function get_connection()
{
if (is_object($this->client)) {
return $this->client;
}
$enable_xdebug = function_exists('xdebug_is_enabled') && xdebug_is_enabled() ? true : false;
// disable xdebug
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
// setup a new SoapClient and don't cache the WSDL
$this->client = @new SoapClient($this->endpoint, array('cache_wsdl' => 'WSDL_CACHE_NONE'));
// enable xdebug
if ($enable_xdebug && function_exists('xdebug_enable')) {
xdebug_enable();
}
return $this->client;
}
开发者ID:costinelmarin,项目名称:woocommerce-sage-erp-connector,代码行数:27,代码来源:class-wc-sage-erp-connector-api.php
示例11: define
* Test environment constants
*/
define('PHPILLOW_TEST_ENV_SET_UP', true);
/**
* Set timezone to get clearly defined dates
*/
date_default_timezone_set('UTC');
require __DIR__ . '/../vendor/autoload.php';
require dirname(__FILE__) . '/helper/general.php';
/**
* Fix error reporting settings for test runs
*/
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
if (function_exists('xdebug_enable')) {
xdebug_enable(true);
}
/**
* Set up mocks and fakes for the current test environment
*
* @package Tests
* @version $Revision$
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPL
*/
class phpillowTestEnvironmentSetup
{
/**
* Reset database depending on provided options
*
* @param array $options
* @return void
示例12: enable
/**
* Enable showing stack traces on error conditions.
* @return void
*/
public function enable()
{
xdebug_enable();
}
示例13: xdebug_enable
require_once 'GLA_PostFinalize.cc.php';
require_once 'GLA.cc.php';
require_once 'GT.cc.php';
require_once 'GIST.cc.php';
require_once 'JoinLHS.cc.php';
require_once 'JoinLHSHash.cc.php';
require_once 'JoinRHS.cc.php';
require_once 'JoinMergeWorkFuncs.cc.php';
require_once 'Cleaner.cc.php';
require_once 'Cache.cc.php';
require_once 'Cluster.cc.php';
require_once 'grokit_codegen.php';
require_once 'codegen_helpers.php';
require_once 'Make.php';
/*************** HELPER FUNCTIONS ************************/
xdebug_enable();
/*************** COMMAND LINE PARSING *********************/
if ($argc < 2) {
echo "Usage: php Process.php query.json";
exit(1);
}
if (!file_exists($argv[1])) {
echo "File " . $argv[1] . " cannot be read";
exit(1);
}
$configFile = './config/default.json';
if ($argc >= 3) {
$configFile = $argv[2];
}
if (!file_exists($configFile)) {
echo "Configuration file " . $configFile . " does not exist" . PHP_EOL;
示例14: testRegister
function testRegister()
{
$f = tempnam('/', 'test');
$this->assertTrue(false !== $f);
error_reporting(-1);
$h = new InDepthErrorHandler(null, array('scream' => E_PARSE, 'trace' => 0));
InDepthErrorHandler::register($h, $f);
$h = InDepthErrorHandler::getHandler();
$h->getLogger()->loggedGlobals = array();
try {
user_error('fake user error', E_USER_ERROR);
$this->assertFalse(true);
} catch (\Patchwork\PHP\InDepthRecoverableErrorException $e) {
$h->handleUncaughtException($e);
}
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
eval("");
// Uncatchable E_COMPILE_WARNING
if (function_exists('xdebug_disable')) {
xdebug_enable();
}
error_reporting(0);
@eval('abc');
// Parse error to populate error_get_last()
InDepthErrorHandler::shutdown();
error_reporting(-1);
$e = file_get_contents($f);
unlink($f);
$this->assertStringMatchesFormat('*** php-error ***
{"_":"1:array:3",
"time": "%s %dus - %fms - %fms",
"mem": "%d - %d",
"data": {"_":"4:array:4",
"mesg": "Uncaught \\\\Patchwork\\\\PHP\\\\InDepthRecoverableErrorException: fake user error",
"type": "E_ERROR ' . __FILE__ . ':43",
"level": "1/-1",
"exception": {"_":"8:Patchwork\\\\PHP\\\\InDepthRecoverableErrorException",
"context": {"_":"9:array:2",
"f": "' . $f . '",
"h": {"_":"11:Patchwork\\\\PHP\\\\InDepthErrorHandler",
"*:loggedErrors": -1,
"*:screamErrors": 4,
"*:thrownErrors": 4437,
"*:scopedErrors": 0,
"*:tracedErrors": 0,
"*:logger": {"_":"17:Patchwork\\\\PHP\\\\Logger",
"lineFormat": "%s",
"loggedGlobals": [],
"*:uniqId": %d,
"*:logStream": {"_":"21:resource:stream",
"~:wrapper_type": "plainfile",
"~:stream_type": "STDIO",
"~:mode": "ab",
"~:unread_bytes": 0,
"~:seekable": true,
"~:uri": "/tmp/test%s",
"~:timed_out": false,
"~:blocked": true,
"~:eof": false
},
"*:prevTime": %f,
"*:startTime": %f,
"*:isFirstEvent": true
},
"*:loggedTraces": []
}
},
"*:message": "fake user error",
"*:code": 0,
"*:file": "' . __FILE__ . '",
"*:line": 43,
"*:severity": "E_USER_ERROR",
"~:hash": "%x"
}
}
}
***
[%s] PHP Warning: Unexpected character in input: ' . "''" . ' (ASCII=1) state=0 in ' . __FILE__ . '(52) : eval()\'d code on line 1
*** php-error ***
{"_":"1:array:3",
"time": "%s %dus - %fms - %fms",
"mem": "%d - %d",
"data": {"_":"4:array:3",
"mesg": "syntax error, unexpected ' . (PHP_VERSION_ID >= 50400 ? 'end of file' : '$end') . '",
"type": "E_PARSE ' . __FILE__ . '(56) : eval()\'d code:1",
"level": "4/0"
}
}
***
', $e);
}
示例15: testMaximumNesting
public function testMaximumNesting()
{
if (!function_exists('xdebug_is_enabled')) {
$this->markTestSkipped('xDebug is not installed');
}
$xdebug_start = !xdebug_is_enabled();
if ($xdebug_start) {
xdebug_enable();
}
ini_set('xdebug.max_nesting_level', 200);
$file = new \SplTempFileObject();
for ($i = 0; $i < 500; $i++) {
$file->fwrite("1,2,3\n");
}
$reader = new CsvReader($file);
$reader->rewind();
$reader->setStrict(true);
$reader->setColumnHeaders(array('one', 'two'));
$current = $reader->current();
$this->assertEquals(null, $current);
if ($xdebug_start) {
xdebug_disable();
}
}