本文整理汇总了PHP中debug_print_backtrace函数的典型用法代码示例。如果您正苦于以下问题:PHP debug_print_backtrace函数的具体用法?PHP debug_print_backtrace怎么用?PHP debug_print_backtrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_print_backtrace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
/**
* @brief Generates a user-level error/warning/notice message
*
* @param string $error_msg The designated error message for this error.
* @param string $error_type The designated error type for this error.It
* only works with the E_USER family of constants.
*/
public function error($error_msg, $error_type = E_USER_ERROR)
{
echo '<pre>';
debug_print_backtrace();
echo '</pre>';
trigger_error($error_msg, $error_type);
}
示例2: actionLink
function actionLink($action, $id = "", $args = "", $urlname = "")
{
global $boardroot, $mainPage;
if ($boardroot == "") {
$boardroot = "./";
}
$bucket = "linkMangler";
include 'lib/pluginloader.php';
$res = "";
if ($action != $mainPage) {
$res .= "&page={$action}";
}
if ($id != "") {
$res .= "&id=" . urlencode($id);
}
if ($args) {
$res .= "&{$args}";
}
if (strpos($res, "&")) {
debug_print_backtrace();
Kill("Found &amp; in link");
}
if ($res == "") {
return $boardroot;
} else {
return $boardroot . "?" . substr($res, 1);
}
}
示例3: halt
/**
* 错误输出
* @param mixed $error 错误
* @return void
*/
function halt($error)
{
$e = array();
if (APP_DEBUG) {
//调试模式下输出错误信息
if (!is_array($error)) {
$trace = debug_backtrace();
$e['message'] = $error;
$e['file'] = $trace[0]['file'];
$e['line'] = $trace[0]['line'];
ob_start();
debug_print_backtrace();
$e['trace'] = ob_get_clean();
} else {
$e = $error;
}
} else {
//否则定向到错误页面
$error_page = C('ERROR_PAGE');
if (!empty($error_page)) {
redirect($error_page);
} else {
if (C('SHOW_ERROR_MSG')) {
$e['message'] = is_array($error) ? $error['message'] : $error;
} else {
$e['message'] = C('ERROR_MESSAGE');
}
}
}
// 包含异常页面模板
include C('TMPL_EXCEPTION_FILE');
exit;
}
示例4: fatalError
/**
* 致命错误
* 程序执行完后执行的操作,有些级别的错误self::appError是捕捉不到的
* @return void
*/
public static function fatalError()
{
// error_get_last() 函数获取最后发生的错误。
// 该函数以数组的形式返回最后发生的错误。
// 返回的数组包含 4 个键和值:
// [type] - 错误类型
// [message] - 错误消息
// [file] - 发生错误所在的文件
// [line] - 发生错误所在的行
if ($errorArray = error_get_last()) {
switch ($errorArray['type']) {
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
ob_end_clean();
// 致命的错误,要停止运行,清除以前的所有输出
ob_start();
// 开启缓冲区
debug_print_backtrace();
// 输出调试信息
$errorArray['trace'] = ob_get_clean();
// 获取刚输出到缓冲区的调试信息
include dirname(__DIR__) . '/Views/fatalError.php';
break;
}
}
}
示例5: __autoload
function __autoload($class_name)
{
static $files = null;
$success = false;
$class_file = strtolower($class_name) . '.php';
if (empty($files)) {
$files = array();
$glob = glob(MICROSITE_PATH . '/microsite/classes/*.php');
$fnames = array_map(create_function('$a', 'return strtolower(basename($a));'), $glob);
$files = array_merge($files, array_combine($fnames, $glob));
$glob = glob(MICROSITE_PATH . '/microsite/controllers/*.php');
$fnames = array_map(create_function('$a', 'return strtolower(basename($a, ".php") . "controller.php");'), $glob);
$files = array_merge($files, array_combine($fnames, $glob));
}
// Search in the available files for the undefined class file.
if (isset($files[$class_file])) {
require $files[$class_file];
// If the class has a static method named __static(), execute it now, on initial load.
if (class_exists($class_name, false) && method_exists($class_name, '__static')) {
call_user_func(array($class_name, '__static'));
}
$success = true;
}
if (!$success) {
var_dump($class_name);
var_dump($files);
debug_print_backtrace();
}
}
示例6: my_die
function my_die($text)
{
echo '</select></p></div><div style="padding: 1em; color:red; font-size:120%; background-color:#CEECF5;">' . '<p><b>Fatal Error:</b> ' . tohtml($text) . "</p></div><hr /><pre>Backtrace:\n\n";
debug_print_backtrace();
echo '</pre><hr />';
die('</body></html>');
}
示例7: _preg_error
private function _preg_error()
{
switch (preg_last_error()) {
case PREG_INTERNAL_ERROR:
echo 'PREG_INTERNAL_ERROR';
break;
case PREG_BACKTRACK_LIMIT_ERROR:
echo 'PREG_BACKTRACK_LIMIT_ERROR';
break;
case PREG_RECURSION_LIMIT_ERROR:
echo 'PREG_RECURSION_LIMIT_ERROR';
break;
case PREG_BAD_UTF8_ERROR:
echo 'PREG_BAD_UTF8_ERROR';
break;
// This is only valid for php > 5.3, not certain how to code around it for unit tests
// case PREG_BAD_UTF8_OFFSET_ERROR: echo('PREG_BAD_UTF8_OFFSET_ERROR'); break;
// This is only valid for php > 5.3, not certain how to code around it for unit tests
// case PREG_BAD_UTF8_OFFSET_ERROR: echo('PREG_BAD_UTF8_OFFSET_ERROR'); break;
default:
//die("Unknown preg error.");
return;
}
echo "<hr><pre>";
debug_print_backtrace();
die;
}
示例8: testRegistering
public function testRegistering()
{
$this->appMock->expects($this->at(0))->method('singleton')->will($this->returnCallback(function ($boundTo, $closure) {
switch ($boundTo) {
case BladedServiceProvider::PROVIDES_SERVICE:
$this->assertTrue($closure($this->appMock) instanceof BladedManager);
break;
case IBladedManager::class:
$this->assertTrue($closure($this->appMock) instanceof BladedManager);
break;
case BladedServiceProvider::PROVIDES_STRING_COMPILER:
$this->assertTrue($closure($this->appMock) instanceof StringCompiler);
break;
default:
var_dump($boundTo);
die('dead: ' . debug_print_backtrace());
}
}));
$this->appMock->expects($this->any())->method('make')->will($this->returnCallback(function ($resolvable) {
switch ($resolvable) {
case 'files':
return new Filesystem();
case 'blade.compiler':
return $this->bladeCompilerMock;
case 'path.storage':
return __DIR__;
default:
var_dump($resolvable);
die('dead');
}
}));
$this->assertNull($this->testInstance->registering());
}
示例9: assert
public function assert($cond, $msg = 'Error', $params = array())
{
// TODO: obtener un mensaje que diga mas, linea, clase y
// metodo donde se intenta verificar la condicion
//if (!$cond) $this->suite->report('error');
if (!$cond) {
// http://php.net/manual/en/function.debug-backtrace.php
ob_start();
debug_print_backtrace();
// Stack de llamadas que resultaron en un test que falla
$trace = ob_get_contents();
// Trace es lo mismo que moreInfo pero abajo se procesa para mostrar solo el trace que importa.
$moreInfo = ob_get_contents();
// Todos los echos y prints que se pudieron hacer
ob_end_clean();
// Se quita la llamada a este metodo de el stack (assert)
$pos = strpos($trace, "\n#1 ");
if ($pos !== false) {
$trace = substr($trace, $pos);
}
// TODO: hay que remover las ultimas lineas que son llamadas del framework
/*
* #4 CoreController->testAppAction(Array ()) called at [C:\wamp\www\YuppPHPFramework\core\mvc\core.mvc.YuppController.class.php:59]
#5 YuppController->__call(testApp, Array ())
#6 CoreController->testApp() called at [C:\wamp\www\YuppPHPFramework\core\routing\core.routing.Executer.class.php:163]
#7 Executer->execute() called at [C:\wamp\www\YuppPHPFramework\core\web\core.web.RequestManager.class.php:158]
#8 RequestManager::doRequest() called at [C:\wamp\www\YuppPHPFramework\index.php:94]
*/
$this->suite->report(get_class($this), 'ERROR', $msg, $trace, $moreInfo, $params);
} else {
// tengo que mostrar los tests correctos
$this->suite->report(get_class($this), 'OK', $msg);
}
}
示例10: d
function d($a)
{
print "<pre>";
var_dump($a);
debug_print_backtrace(0, 3);
die;
}
示例11: handlerAsserts
public static function handlerAsserts($file, $line, $code)
{
echo "<hr>Echec de l'assertion :\r\n\t\t\tFile '{$file}'<br />\r\n\t\t\tLine '{$line}'<br />\r\n\t\t\tCode '{$code}'<br /><hr />";
echo "<pre>";
debug_print_backtrace();
echo "</pre>";
}
示例12: testValue
/**
* @throws Exception
*/
public function testValue($value)
{
if (!is_a($value, $this->typeOf)) {
debug_print_backtrace();
throw new \Exception('Element is not an instance of: ' . $this->typeOf);
}
}
示例13: __construct
public function __construct($name, $type, $file)
{
if (DEBUG) {
debug_print_backtrace();
}
trigger_error(sprintf("File '%s' requires %s '%s', which is not available.", $file, $type, $name), E_USER_ERROR);
}
示例14: run
public function run()
{
foreach ($this->testCases as $testCase) {
try {
$testCase->run();
} catch (Exception $e) {
ob_start();
debug_print_backtrace();
// Stack de llamadas que resultaron en un test que falla
$trace = ob_get_contents();
$moreInfo = ob_get_contents();
// Todos los echos y prints que se pudieron hacer
ob_end_clean();
// Se quita la llamada a este metodo de el stack (assert)
$pos = strpos($trace, "\n");
if ($pos !== false) {
$trace = substr($trace, $pos);
}
// TODO: hay que remover las ultimas lineas que son llamadas del framework
/*
* #4 CoreController->testAppAction(Array ()) called at [C:\wamp\www\YuppPHPFramework\core\mvc\core.mvc.YuppController.class.php:59]
#5 YuppController->__call(testApp, Array ())
#6 CoreController->testApp() called at [C:\wamp\www\YuppPHPFramework\core\routing\core.routing.Executer.class.php:163]
#7 Executer->execute() called at [C:\wamp\www\YuppPHPFramework\core\web\core.web.RequestManager.class.php:158]
#8 RequestManager::doRequest() called at [C:\wamp\www\YuppPHPFramework\index.php:94]
*/
$this->report(get_class($testCase), 'EXCEPTION', $e->getMessage(), $trace, $moreInfo);
}
}
}
示例15: query
function query($req)
{
// Si c'est la première requête
if ($this->reqcount == 0) {
// on ititialise les paramètres
$this->initParams();
}
// On incrémente le compteur de requêtes
$this->reqcount++;
// Si la requête n'arrive pas à s'exécuter
if (!($res = parent::query($req))) {
// On commencer à mettre la sortie dans un buffer (ob = output buffer)
ob_start();
// On affiche l'état de la pile d'appel (pour savoir pourquoi ça plante, d'uù le script est lancé)
debug_print_backtrace();
// On écrit tout ça dans un fichier de logs "mysql_errors" avec la date, l'erreur, la requête SQL associée et l'état de la pile d'appel dans le buffer
file_put_contents(FONCTIONS . "mysql_errors", date('[d/m/Y - H:i:s]') . ' Erreur MySQL : ' . $this->error . ' pendant la requête ' . $req . '
Backtrace:
' . ob_get_contents());
// On termine la capture de la sortie et on efface ce qu'on a enregistré
ob_end_clean();
// Et on termine le script.
die("Une erreur s'est produite: " . $this->error);
}
// Sinon, tout va bien, on renvoie le résultat.
return $res;
}