提交 ca167ccd authored 作者: Raymond Chandler's avatar Raymond Chandler

it's kinda dumb to have an error handler that requires a class that will throw…

it's kinda dumb to have an error handler that requires a class that will throw an error if it doesn't exist :-\

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@14880 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a5ef2801
...@@ -18,32 +18,22 @@ define('START_TIME', ereg_replace('^0\.([0-9]+) ([0-9]+)$', '\2.\1', microtime() ...@@ -18,32 +18,22 @@ define('START_TIME', ereg_replace('^0\.([0-9]+) ([0-9]+)$', '\2.\1', microtime()
* critical error condition before the fs_curl * critical error condition before the fs_curl
* class is successfully instantiated. * class is successfully instantiated.
* @return void * @return void
*/ */
function file_not_found($no=false, $str=false, $file=false, $line=false) { function file_not_found($no=false, $str=false, $file=false, $line=false) {
if ($no == E_STRICT) { if ($no == E_STRICT) {
return; return;
} }
header('Content-Type: text/xml'); header('Content-Type: text/xml');
$xmlw = new XMLWriter(); printf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
$xmlw -> openMemory(); printf("<document type=\"freeswitch/xml\">\n");
$xmlw -> setIndent(true); printf(" <section name=\"result\">\n");
$xmlw -> setIndentString(' '); printf(" <result status=\"not found\"/>\n");
$xmlw -> startDocument('1.0', 'UTF-8', 'no'); printf(" </section>\n");
//set the freeswitch document type
$xmlw -> startElement('document');
$xmlw -> writeAttribute('type', 'freeswitch/xml');
$xmlw -> startElement('section');
$xmlw -> writeAttribute('name', 'result');
$xmlw -> startElement('result');
$xmlw -> writeAttribute('status', 'not found');
$xmlw -> endElement();
$xmlw -> endElement();
$xmlw -> endElement();
if (!empty($no) && !empty($str) && !empty($file) &&!empty($line)) { if (!empty($no) && !empty($str) && !empty($file) &&!empty($line)) {
$xmlw -> writeComment("ERROR: $no - ($str) on line $line of $file"); printf(" <!-- ERROR: $no - ($str) on line $line of $file -->\n");
} }
echo $xmlw -> outputMemory(); printf("</document>\n");
exit(); exit();
} }
error_reporting(E_ALL); error_reporting(E_ALL);
...@@ -51,14 +41,14 @@ set_error_handler('file_not_found'); ...@@ -51,14 +41,14 @@ set_error_handler('file_not_found');
if (!class_exists('XMLWriter')) { if (!class_exists('XMLWriter')) {
trigger_error( trigger_error(
"XMLWriter Class NOT Found... You Must install it before using this package" "XMLWriter Class NOT Found... You Must install it before using this package"
, E_USER_ERROR , E_USER_ERROR
); );
} }
if (!(@include_once('fs_curl.php')) if (!(@include_once('fs_curl.php'))
|| !(@include_once('global_defines.php'))) { || !(@include_once('global_defines.php'))) {
trigger_error( trigger_error(
'could not include fs_curl.php or global_defines.php', E_USER_ERROR 'could not include fs_curl.php or global_defines.php', E_USER_ERROR
); );
} }
if (!is_array($_REQUEST)) { if (!is_array($_REQUEST)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论