* List of http compression methods accepted by the client for responses.
* NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib.
*
- * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since
- * in those cases it will be up to CURL to decide the compression methods
- * it supports. You might check for the presence of 'zlib' in the output of
+ * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since in those cases it will be up to CURL to
+ * decide the compression methods it supports. You might check for the presence of 'zlib' in the output of
* curl_version() to determine whether compression is supported or not
*/
public $accepted_compression = array();
$uri = $this->path;
}
- // Cookie generation, as per rfc2965 (version 1 cookies) or
- // netscape's rules (version 0 cookies)
+ // Cookie generation, as per rfc2965 (version 1 cookies) or netscape's rules (version 0 cookies)
$cookieHeader = '';
if (count($this->cookies)) {
$version = '';
curl_setopt($curl, CURLOPT_HEADER, 1);
// NB: if we set an empty string, CURL will add http header indicating
- // ALL methods it is supporting. This is possibly a better option than
- // letting the user tell what curl can / cannot do...
+ // ALL methods it is supporting. This is possibly a better option than letting the user tell what curl can / cannot do...
if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
//curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
// empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
if ($keyPass) {
curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keyPass);
}
- // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
+ // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that
+ // it matches the hostname used
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);
// allow usage of different SSL versions
curl_setopt($curl, CURLOPT_SSLVERSION, $sslVersion);
}
// NB: should we build cookie http headers by hand rather than let CURL do it?
- // the following code does not honour 'expires', 'path' and 'domain' cookie attributes
- // set to client obj the the user...
+ // the following code does not honour 'expires', 'path' and 'domain' cookie attributes set to client obj the the user...
if (count($this->cookies)) {
$cookieHeader = '';
foreach ($this->cookies as $name => $cookie) {
*
* Works with xmlrpc requests objects as input, too.
*
- * Given proper options parameter, can rebuild generic php object instances
- * (provided those have been encoded to xmlrpc format using a corresponding
- * option in php_xmlrpc_encode())
+ * Given proper options parameter, can rebuild generic php object instances (provided those have been encoded to
+ * xmlrpc format using a corresponding option in php_xmlrpc_encode())
* PLEASE NOTE that rebuilding php objects involves calling their constructor function.
- * This means that the remote communication end can decide which php code will
- * get executed on your server, leaving the door possibly open to 'php-injection'
- * style of attacks (provided you have some classes defined on your server that
- * might wreak havoc if instances are built outside an appropriate context).
+ * This means that the remote communication end can decide which php code will get executed on your server, leaving
+ * the door possibly open to 'php-injection' style of attacks (provided you have some classes defined on your server
+ * that might wreak havoc if instances are built outside an appropriate context).
* Make sure you trust the remote server/client before eanbling this!
*
* @author Dan Libby (dan@libby.com)
*
* @param Value|Request $xmlrpcVal
- * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects; if 'dates_as_objects' is set xmlrpc datetimes are decoded as php DateTime objects (standard is
+ * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php
+ * objects; if 'dates_as_objects' is set xmlrpc datetimes are decoded as php DateTime objects
*
* @return mixed
*/
}
}
if (in_array('dates_as_objects', $options) && $xmlrpcVal->scalartyp() == 'dateTime.iso8601') {
- // we return a Datetime object instead of a string
- // since now the constructor of xmlrpc value accepts safely strings, ints and datetimes,
- // we cater to all 3 cases here
+ // we return a Datetime object instead of a string since now the constructor of xmlrpc value accepts
+ // safely strings, ints and datetimes, we cater to all 3 cases here
$out = $xmlrpcVal->scalarval();
if (is_string($out)) {
$out = strtotime($out);
case 'struct':
// If user said so, try to rebuild php objects for specific struct vals.
/// @todo should we raise a warning for class not found?
- // shall we check for proper subclass of xmlrpc value instead of
- // presence of _php_class to detect what we can do?
+ // shall we check for proper subclass of xmlrpc value instead of presence of _php_class to detect
+ // what we can do?
if (in_array('decode_php_objs', $options) && $xmlrpcVal->_php_class != ''
&& class_exists($xmlrpcVal->_php_class)
) {
* Feature creep -- could support more types via optional type argument
* (string => datetime support has been added, ??? => base64 not yet)
*
- * If given a proper options parameter, php object instances will be encoded
- * into 'special' xmlrpc values, that can later be decoded into php objects
- * by calling php_xmlrpc_decode() with a corresponding option
+ * If given a proper options parameter, php object instances will be encoded into 'special' xmlrpc values, that can
+ * later be decoded into php objects by calling php_xmlrpc_decode() with a corresponding option
*
* @author Dan Libby (dan@libby.com)
*
$xmlrpcVal = new Value($phpVal, Value::$xmlrpcBoolean);
break;
case 'array':
- // PHP arrays can be encoded to either xmlrpc structs or arrays,
- // depending on whether they are hashes or plain 0..n integer indexed
+ // PHP arrays can be encoded to either xmlrpc structs or arrays, depending on whether they are hashes
+ // or plain 0..n integer indexed
// A shorter one-liner would be
// $tmp = array_diff(array_keys($phpVal), range(0, count($phpVal)-1));
// but execution time skyrockets!
* Convert the xml representation of a method response, method request or single
* xmlrpc value into the appropriate object (a.k.a. deserialize).
*
- * Q: is this a good name for this method? It does something quite different from 'decode' after all (returning objects vs returns plain php values)...
+ * Q: is this a good name for this method? It does something quite different from 'decode' after all
+ * (returning objects vs returns plain php values)...
*
* @param string $xmlVal
* @param array $options
// Since parsing will fail if charset is not specified in the xml prologue,
// the encoding is not UTF8 and there are non-ascii chars in the text, we try to work round that...
- // The following code might be better for mb_string enabled installs, but
- // makes the lib about 200% slower...
+ // The following code might be better for mb_string enabled installs, but makes the lib about 200% slower...
//if (!is_valid_charset($valEncoding, array('UTF-8'))
if (!in_array($valEncoding, array('UTF-8', 'US-ASCII')) && !XMLParser::hasEncoding($xmlVal)) {
if ($valEncoding == 'ISO-8859-1') {
{
// tables used for transcoding different charsets into us-ascii xml
protected $xml_iso88591_Entities = array("in" => array(), "out" => array());
- protected $xml_iso88591_utf8 = array("in" => array(), "out" => array());
/// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159?
- /// These will NOT be present in true ISO-8859-1, but will save the unwary
- /// windows user from sending junk (though no luck when receiving them...)
+ /// These will NOT be present in true ISO-8859-1, but will save the unwary windows user from sending junk
+ /// (though no luck when receiving them...)
/*
protected $xml_cp1252_Entities = array('in' => array(), out' => array(
'€', '?', '‚', 'ƒ',
}
/**
- * Checks if a given charset encoding is present in a list of encodings or
- * if it is a valid subset of any encoding in the list.
+ * Checks if a given charset encoding is present in a list of encodings or if it is a valid subset of any encoding
+ * in the list.
*
* @param string $encoding charset to be tested
* @param string|array $validList comma separated list of valid charsets (or array of charsets)
/**
* Given a timestamp, return the corresponding ISO8601 encoded string.
*
- * Really, timezones ought to be supported
- * but the XML-RPC spec says:
+ * Really, timezones ought to be supported but the XML-RPC spec says:
*
- * "Don't assume a timezone. It should be specified by the server in its
- * documentation what assumptions it makes about timezones."
+ * "Don't assume a timezone. It should be specified by the server in its documentation what assumptions it makes
+ * about timezones."
*
- * These routines always assume localtime unless
- * $utc is set to 1, in which case UTC is assumed
- * and an adjustment for locale is made when encoding
+ * These routines always assume localtime unless $utc is set to 1, in which case UTC is assumed and an adjustment
+ * for locale is made when encoding
*
* @param int $timet (timestamp)
* @param int $utc (0 or 1)
'server_decompress_fail' => 'Received from client invalid compressed HTTP request',
);
- // The charset encoding used by the server for received requests and
- // by the client for received responses when received charset cannot be determined
- // and mbstring extension is not enabled
+ // The charset encoding used by the server for received requests and by the client for received responses when
+ // received charset cannot be determined and mbstring extension is not enabled
public static $xmlrpc_defencoding = "UTF-8";
- // The list of encodings used by the server for requests and by the client for responses
- // to detect the charset of the received payload when
+ // The list of encodings used by the server for requests and by the client for responses to detect the charset of
+ // the received payload when
// - the charset cannot be determined by looking at http headers, xml declaration or BOM
// - mbstring extension is enabled
public static $xmlrpc_detectencodings = array();
// The encoding used internally by PHP.
- // String values received as xml will be converted to this, and php strings will be converted to xml
- // as if having been coded with this.
+ // String values received as xml will be converted to this, and php strings will be converted to xml as if
+ // having been coded with this.
// Valid also when defining names of xmlrpc methods
public static $xmlrpc_internalencoding = "UTF-8";
$GLOBALS[$name] = $value;
}
- // NB: all the variables exported into the global namespace below here do NOT guarantee 100%
- // compatibility, as they are NOT reimported back during calls to importGlobals()
+ // NB: all the variables exported into the global namespace below here do NOT guarantee 100% compatibility,
+ // as they are NOT reimported back during calls to importGlobals()
$reflection = new \ReflectionClass('PhpXmlRpc\Value');
foreach ($reflection->getStaticProperties() as $name => $value) {
// Since parsing will fail if charset is not specified in the xml prologue,
// the encoding is not UTF8 and there are non-ascii chars in the text, we try to work round that...
- // The following code might be better for mb_string enabled installs, but
- // makes the lib about 200% slower...
+ // The following code might be better for mb_string enabled installs, but makes the lib about 200% slower...
//if (!is_valid_charset($respEncoding, array('UTF-8')))
if (!in_array($respEncoding, array('UTF-8', 'US-ASCII')) && !XMLParser::hasEncoding($data)) {
if ($respEncoding == 'ISO-8859-1') {
// PHP internally might use ISO-8859-1, so we have to tell the xml parser to give us back data in the expected charset.
// What if internal encoding is not in one of the 3 allowed? We use the broadest one, ie. utf8
- // This allows to send data which is native in various charset,
- // by extending xmlrpc_encode_entities() and setting xmlrpc_internalencoding
+ // This allows to send data which is native in various charset, by extending xmlrpc_encode_entities() and
+ // setting xmlrpc_internalencoding
if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
$options = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
} else {
}
/**
- * Add a string to the debug info that can be later serialized by the server
- * as part of the response message.
- * Note that for best compatibility, the debug string should be encoded using
- * the PhpXmlRpc::$xmlrpc_internalencoding character set.
+ * Add a string to the debug info that can be later serialized by the server as part of the response message.
+ * Note that for best compatibility, the debug string should be encoded using the PhpXmlRpc::$xmlrpc_internalencoding
+ * character set.
*
* @param string $msg
* @access public