X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=demo%2Fserver%2Fserver.php;h=45caf6490df20763b3933adc1a5120b5e700a53c;hb=05102eb7d8c0faad30ae3719e2045c1af72b9e9d;hp=2a8d18590b816c88791d77de67eadf7218f2970b;hpb=26ac91603dc5dab166667622bbc5e7de6d585f3c;p=plcapi.git diff --git a/demo/server/server.php b/demo/server/server.php index 2a8d185..45caf64 100644 --- a/demo/server/server.php +++ b/demo/server/server.php @@ -8,7 +8,6 @@ * * Please do not copy this file verbatim into your production server. * - * @version $Id$ **/ // give user a chance to see the source for this server instead of running the services @@ -27,7 +26,7 @@ if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) */ class xmlrpc_server_methods_container { - /* + /** * Method used to test logging of php warnings generated by user functions. */ function phpwarninggenerator($m) @@ -36,14 +35,22 @@ if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) return new xmlrpcresp(new xmlrpcval(1, 'boolean')); } - /** - * a PHP version of the state-number server. Send me an integer and i'll sell you a state - * @param integer $s - * @return string - * */ - function findstate($s) - { - return inner_findstate($s); + /** + * Method used to testcatching of exceptions in the server. + */ + function exceptiongenerator($m) + { + throw new Exception("it's just a test", 1); + } + + /** + * a PHP version of the state-number server. Send me an integer and i'll sell you a state + * @param integer $s + * @return string + */ + static function findstate($s) + { + return inner_findstate($s); } } @@ -129,8 +136,9 @@ in an alphabetic order.'; $findstate3_sig = wrap_php_function(array('xmlrpc_server_methods_container', 'findstate')); - $obj = new xmlrpc_server_methods_container(); + $findstate5_sig = wrap_php_function('xmlrpc_server_methods_container::findstate'); + $obj = new xmlrpc_server_methods_container(); $findstate4_sig = wrap_php_function(array($obj, 'findstate')); $addtwo_sig=array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt)); @@ -227,8 +235,8 @@ in an alphabetic order.'; // don't even ask me _why_ these come padded with // hyphens, I couldn't tell you :p - $a=ereg_replace("-", "", $a); - $b=ereg_replace("-", "", $b); + $a=str_replace("-", "", $a); + $b=str_replace("-", "", $b); if ($agesorter_arr[$a]==$agesorter[$b]) { @@ -241,7 +249,7 @@ in an alphabetic order.'; $agesorter_doc='Send this method an array of [string, int] structs, eg:
  Dave   35
- Edd    45
+ Edd	45
  Fred   23
  Barney 37
 
@@ -570,9 +578,9 @@ mimetype, a string, is a standard MIME type, for example, text/plain. return new xmlrpcresp(new xmlrpcval(array( "ctLeftAngleBrackets" => new xmlrpcval($lt, "int"), "ctRightAngleBrackets" => new xmlrpcval($gt, "int"), - "ctAmpersands" => new xmlrpcval($amp, "int"), - "ctApostrophes" => new xmlrpcval($ap, "int"), - "ctQuotes" => new xmlrpcval($qu, "int")), + "ctAmpersands" => new xmlrpcval($amp, "int"), + "ctApostrophes" => new xmlrpcval($ap, "int"), + "ctQuotes" => new xmlrpcval($qu, "int")), "struct" )); } @@ -692,6 +700,9 @@ mimetype, a string, is a standard MIME type, for example, text/plain. "function" => array($o, "phpwarninggenerator") //'function' => 'xmlrpc_server_methods_container::phpwarninggenerator' ), + "examples.raiseException" => array( + "function" => array($o, "exceptiongenerator") + ), "examples.getallheaders" => array( "function" => 'getallheaders_xmlrpc', "signature" => $getallheaders_sig, @@ -823,6 +834,9 @@ mimetype, a string, is a standard MIME type, for example, text/plain. if ($findstate4_sig) $a['examples.php3.getStateName'] = $findstate4_sig; + if ($findstate5_sig) + $a['examples.php4.getStateName'] = $findstate5_sig; + $s=new xmlrpc_server($a, false); $s->setdebug(3); $s->compress_response = true; @@ -831,7 +845,8 @@ mimetype, a string, is a standard MIME type, for example, text/plain. // we do this to help the testsuite script: do not reproduce in production! if (isset($_GET['RESPONSE_ENCODING'])) $s->response_charset_encoding = $_GET['RESPONSE_ENCODING']; - + if (isset($_GET['EXCEPTION_HANDLING'])) + $s->exception_handling = $_GET['EXCEPTION_HANDLING']; $s->service(); // that should do all we need! ?> \ No newline at end of file