本文整理汇总了PHP中wddx_serialize_value函数的典型用法代码示例。如果您正苦于以下问题:PHP wddx_serialize_value函数的具体用法?PHP wddx_serialize_value怎么用?PHP wddx_serialize_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wddx_serialize_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encode
/**
* @param mixed $decoded
*
* @return string
*/
public function encode($decoded) : string
{
if ($this->hasComment()) {
return wddx_serialize_value($decoded, $this->getComment());
}
return wddx_serialize_value($decoded);
}
示例2: useSlowPrinter
public static function useSlowPrinter()
{
if (!function_exists('wddx_serialize_value')) {
return true;
}
// Some versions of PHP have a broken wddx_serialize_value, see
// PHP bug 45314. Test encoding an affected character (U+00A0)
// to avoid this.
$expected = "<wddxPacket version='1.0'><header/><data><string> </string></data></wddxPacket>";
if (wddx_serialize_value(" ") !== $expected) {
return true;
}
// Some versions of HHVM don't correctly encode ampersands.
$expected = "<wddxPacket version='1.0'><header/><data><string>&</string></data></wddxPacket>";
if (wddx_serialize_value('&') !== $expected) {
return true;
}
// Some versions of HHVM don't correctly encode empty arrays as subvalues.
$expected = "<wddxPacket version='1.0'><header/><data><array length='1'><array length='0'></array></array></data></wddxPacket>";
if (wddx_serialize_value(array(array())) !== $expected) {
return true;
}
// Some versions of HHVM don't correctly encode associative arrays with numeric keys.
$expected = "<wddxPacket version='1.0'><header/><data><struct><var name='2'><number>1</number></var></struct></data></wddxPacket>";
if (wddx_serialize_value(array(2 => 1)) !== $expected) {
return true;
}
return false;
}
示例3: ftp_ErrorHandler
function ftp_ErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
if ($errno != 2 && $errno != 8) {
// timestamp for the error entry
$dt = date("Y-m-d H:i:s (T)");
// define an assoc array of error string
// in reality the only entries we should
// consider are 2,8,256,512 and 1024
$errortype = array(1 => "Error", 2 => "Warning", 4 => "Parsing Error", 8 => "Notice", 16 => "Core Error", 32 => "Core Warning", 64 => "Compile Error", 128 => "Compile Warning", 256 => "User Error", 512 => "User Warning", 1024 => "User Notice");
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errnumber>\n";
$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
$err .= "\t<scriptname>" . $filename . "</scriptname>\n";
$err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
debug($err);
}
}
示例4: test
function test()
{
$v = new t1();
$v->set();
echo wddx_serialize_value($v);
print "\n";
}
示例5: serialize
/**
* @param array $value
* @return string
*/
public function serialize($value)
{
if ($value === null || is_array($value) && count($value) == 0) {
return '';
}
return wddx_serialize_value($value);
}
示例6: asXML
public function asXML()
{
$asArray = $this->asArray();
$this->complete(&$asArray);
$erg = wddx_serialize_value($asArray);
return $erg;
}
示例7: userErrorHandler
function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// timestamp for the error entry
$dt = date("Y-m-d H:i:s (T)");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err .= "Errornummer:" . $errno . " ";
$err .= "Errortyp" . $errortype[$errno] . " ";
$err .= "Errormessage:" . $errmsg . " ";
$err .= "Filename:" . $filename . " ";
$err .= "on Line:" . $linenum . " ";
if (in_array($errno, $user_errors)) {
$err .= "Vartrace: " . wddx_serialize_value($vars, "Variables");
}
// for testing
//echo $err;
// save to the error log, and e-mail me if there is a critical user error
/* error_log($err, 3, "/usr/local/php4/error.log");
if ($errno == E_USER_ERROR) {
mail("phpdev@example.com", "Critical User Error", $err);
}*/
}
示例8: logError
public function logError($errno, $errmsg, $filename, $linenum, $vars)
{
$errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = '<errorEntry>';
$err .= '<dateTime>' . date('Y-m-d H:i:s') . '</dateTime>';
$err .= '<errorNum>' . $errno . '</errorNum>';
$err .= '<errorType>' . $errortype[$errno] . '</errorType>';
$err .= '<errorMsg>' . $errmsg . '</errorMsg>';
$err .= '<scriptName>' . $filename . '</scriptName>';
$err .= '<scriptLineNum>' . $linenum . '</scriptLineNum>';
$err .= '<uri>' . (php_sapi_name() === 'cli') ? __FILE__ : $_SERVER['REQUEST_URI'] . '</uri>';
$err .= '<param>';
$array = array_merge($_GET, $_POST);
if (count($array) > 1) {
foreach ($array as $key => $value) {
$err .= '<var>' . $key . '=' . $value . '</var>';
}
}
$err .= '</param>';
if (in_array($errno, $user_errors)) {
$err .= '<varTrace>' . wddx_serialize_value($vars, 'Variables') . '</varTrace>';
}
$err .= '</errorEntry>' . PHP_EOL;
// save to the error log, and e-mail me if there is a critical user error
error_log($err, 3, $this->path . $this->fileName);
if ($errno == E_USER_ERROR) {
//Helper::enviarEmail($err,'Erro critico '.date('Y-m-d H:i:s'));
}
}
示例9: serialize
public function serialize($v)
{
if (!$this->len) {
return wddx_serialize_value($v);
}
if (is_bool($v) || !is_scalar($v)) {
return $this->prefix . wddx_serialize_value($v);
}
return $v;
}
示例10: execute
public function execute()
{
if (function_exists('wddx_serialize_value')) {
$this->printText(wddx_serialize_value($this->getResultData()));
} else {
$this->printText('<?xml version="1.0" encoding="utf-8"?>');
$this->printText('<wddxPacket version="1.0"><header/><data>');
$this->slowWddxPrinter($this->getResultData());
$this->printText('</data></wddxPacket>');
}
}
示例11: myErrorHandler
function myErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// timestamp for the error entry
$dt = date("Y-m-d H:i:s ");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice");
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errornum>\n";
if (isset($errortype[$errno])) {
$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
}
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
$err .= "\t<scriptname>" . $filename . "</scriptname>\n";
$err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$err .= "\t<user-agent>" . $_SERVER['HTTP_USER_AGENT'] . "</user-agent>\n";
}
if (MOBIKAR_LOGGING_WDDX == TRUE && in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
$err_line = $dt;
if (isset($errortype[$errno])) {
$err_line .= "[" . $errortype[$errno] . "]";
}
$err_line .= $errmsg . " " . $filename . " " . $linenum . "\n";
// for testing
// echo $err;
// save to the error log, and e-mail me if there is a critical user error
if ($errno == E_USER_ERROR) {
error_log($err, 3, MOBIKAR_LOGGING_E_USER_ERROR);
if (MOBIKAR_LOGGING_EMAIL != NULL) {
mail(MOBIKAR_LOGGING_EMAIL, "Critical User Error", $err);
}
} else {
if ($errno == E_USER_WARNING) {
error_log($err, 3, MOBIKAR_LOGGING_E_USER_WARNING);
} else {
if ($errno == E_USER_NOTICE) {
error_log($err, 3, MOBIKAR_LOGGING_E_USER_NOTICE);
} else {
error_log($err, 3, MOBIKAR_LOGGING_E_SYS);
}
}
}
error_log($err_line, 3, MOBIKAR_LOGGING_LOG);
}
示例12: errorHandler
function errorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
$errorReporting = ini_get('error_reporting');
if ($errorReporting === 0 || !($errorReporting & $errno)) {
return FALSE;
}
$errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
$err = sprintf("%s -- ", $errortype[$errno], wddx_serialize_value($vars, "Variables"));
print "<pre>";
var_dump($vars);
print "</pre>";
error_log($err);
}
示例13: xpress_error_handler
function xpress_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
{
$module_dirpath = dirname(dirname(__FILE__));
$root_path = dirname(dirname(dirname(dirname(__FILE__))));
$show_backtrace = true;
// Time stamp of error entry
$dt = date("Y-m-d H:i:s (T)");
// define an assoc array of error string
// in reality the only entries we should
// consider are E_WARNING, E_NOTICE, E_USER_ERROR,
// E_USER_WARNING and E_USER_NOTICE
$errortype = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice", E_STRICT => "Runtime Notice");
if (strstr($errstr, 'Use of undefined constant xpress_debug_message - assumed') !== false) {
return;
}
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<datetime>" . $dt . "</datetime>\n";
$err .= "\t<errornum>" . $errno . "</errornum>\n";
$err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
$err .= "\t<errormsg>" . $errstr . "</errormsg>\n";
$err .= "\t<scriptname>" . $errfile . "</scriptname>\n";
$err .= "\t<scriptlinenum>" . $errline . "</scriptlinenum>\n";
$err .= "\t<errcontext>" . $errcontext . "</errcontext>\n";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
$err_trace = '';
if ($show_backtrace) {
$backtraces = array_reverse(debug_backtrace());
$err_trace .= "BACK TRACE\n";
foreach ($backtraces as $backtrace) {
$trace = @$backtrace['file'] . "\tLINE(" . @$backtrace['line'] . ")\t" . @$backtrace['function'] . "()\n";
$trace = str_replace($root_path, "", $trace);
$trace = str_replace("\\", "/", $trace);
$trace = str_replace($root_path, "", $trace);
$trace = "\t" . $trace;
$err_trace .= $trace;
}
}
$head = "\n***** XPressME ERROR LOG ****************************************************************************************************\n";
$message = $head . $err . $err_trace;
$_debug_file = $module_dirpath . '/wp-content/xpress_error.log';
if ($errno != E_STRICT) {
$_fp = fopen($_debug_file, 'a');
fwrite($_fp, $message);
fclose($_fp);
}
}
示例14: errorHandler
/**
* Handle & log errors
*
* @return void
* @see http://php.net/manual/en/errorfunc.examples.php
*/
public static function errorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
// set of errors for which a var trace will be saved
$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
$err = "<errorentry>\n";
$err .= "\t<errortype>" . self::errorType($errno) . "</errortype>\n";
$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
if (in_array($errno, $user_errors)) {
$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
}
$err .= "</errorentry>\n\n";
Logger::Log("ERROR", $err, $filename, $linenum);
self::viewError();
}
示例15: serialize
/**
* Serialize PHP to WDDX
*
* @param mixed $value
* @param array $opts
* @return string
* @throws Zend\Serializer\Exception on wddx error
*/
public function serialize($value, array $opts = array())
{
$opts = $opts + $this->_options;
if (isset($opts['comment']) && $opts['comment']) {
$wddx = wddx_serialize_value($value, (string) $opts['comment']);
} else {
$wddx = wddx_serialize_value($value);
}
if ($wddx === false) {
$lastErr = error_get_last();
throw new RuntimeException($lastErr['message']);
}
return $wddx;
}