* file api_changes_v4.md for how to change this if required.
*****************************************************************************/
-include_once(__DIR__.'/../src/Client.php');
-include_once(__DIR__.'/../src/Encoder.php');
-include_once(__DIR__.'/../src/PhpXmlRpc.php');
-include_once(__DIR__.'/../src/Request.php');
-include_once(__DIR__.'/../src/Response.php');
-include_once(__DIR__.'/../src/Value.php');
+// the list is sorted more-or-less in dependency order
include_once(__DIR__.'/../src/Exception.php');
include_once(__DIR__.'/../src/Exception/FaultResponseException.php');
include_once(__DIR__.'/../src/Exception/ParsingException.php');
include_once(__DIR__.'/../src/Exception/StateErrorException.php');
include_once(__DIR__.'/../src/Exception/TypeErrorException.php');
include_once(__DIR__.'/../src/Exception/ValueErrorException.php');
+include_once(__DIR__.'/../src/PhpXmlRpc.php');
include_once(__DIR__.'/../src/Helper/Charset.php');
include_once(__DIR__.'/../src/Helper/Date.php');
include_once(__DIR__.'/../src/Helper/Http.php');
+include_once(__DIR__.'/../src/Helper/Interop.php');
include_once(__DIR__.'/../src/Helper/Logger.php');
include_once(__DIR__.'/../src/Helper/XMLParser.php');
+include_once(__DIR__.'/../src/Traits/CharsetEncoderAware.php');
+include_once(__DIR__.'/../src/Traits/LoggerAware.php');
+include_once(__DIR__.'/../src/Traits/DeprecationLogger.php');
+include_once(__DIR__.'/../src/Traits/ParserAware.php');
+include_once(__DIR__.'/../src/Value.php');
+include_once(__DIR__.'/../src/Request.php');
+include_once(__DIR__.'/../src/Response.php');
+include_once(__DIR__.'/../src/Client.php');
+include_once(__DIR__.'/../src/Encoder.php');
use PhpXmlRpc\Client;
use PhpXmlRpc\Encoder;
/* Expose with the old names the classes which have been namespaced */
/**
- * @todo reinstate access to method serializedata ?
+ * @todo reinstate access to method serializeData?
*/
class xmlrpcval extends Value
{
$val = reset($ar);
$typ = key($ar);
- return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
+ return '<value>' . $this->serializeData($typ, $val) . "</value>\n";
//}
}
/**
- * @deprecated this code looks like it is very fragile and has not been fixed
- * for a long long time. Shall we remove it for 2.0?
+ * @deprecated this code looks like it is very fragile and has not been fixed for a long long time.
+ * Shall we remove it for 2.0?
*/
public function getval()
{
if (is_array($b)) {
foreach($b as $id => $cont) {
- $b[$id] = $cont->scalarval();
+ $b[$id] = $cont->scalarVal();
}
}
if (is_object($b)) {
$t = get_object_vars($b);
foreach($t as $id => $cont) {
- $t[$id] = $cont->scalarval();
+ $t[$id] = $cont->scalarVal();
}
foreach($t as $id => $cont) {
@$b->$id = $cont;
}
/**
- * @todo reinstate access to method parseResponseHeaders ?
+ * @todo reinstate access to method parseResponseHeaders?
*/
class xmlrpcmsg extends Request
{
}
/**
- * @todo reinstate access to methods sendPayloadHTTP10, sendPayloadHTTPS, sendPayloadCURL, _try_multicall ?
+ * @todo reinstate access to methods sendPayloadHTTP10, sendPayloadHTTPS, sendPayloadCURL, _try_multicall?
*/
class xmlrpc_client extends Client
{
function wrap_php_function($funcName, $newFuncName='', $extraOptions=array())
{
$wrapper = new PhpXmlRpc\Wrapper();
- if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) {
+ if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) {
// backwards compat: return string instead of callable
$extraOptions['return_source'] = true;
$wrapped = $wrapper->wrapPhpFunction($funcName, $newFuncName, $extraOptions);
{
$wrapper = new PhpXmlRpc\Wrapper();
$fix = false;
- if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) {
+ if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) {
// backwards compat: return string instead of callable
$extraOptions['return_source'] = true;
$fix = true;
$respCode = '$res';
}
if ($decodePhpObjects) {
- $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value(), array('decode_php_objs'));";
+ $innerCode .= "if (\$res->faultCode()) return $respCode; else return \$encoder->decode(\$res->value(), array('decode_php_objs'));";
} else {
- $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());";
+ $innerCode .= "if (\$res->faultCode()) return $respCode; else return \$encoder->decode(\$res->value());";
}
$code = $code . $plist . ") {\n" . $innerCode . "\n}\n";
{
return $name === 'dmap';
}
+
+ /// @todo what about __set, __unset?
}
/* Expose as global functions the ones which are now class methods */
return $knownCharsets;
}
+ // *** BC layer ***
+
/**
* 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.
}
/**
- * Used only for backwards compatibility.
+ * Used only for backwards compatibility (the .inc shims).
* @deprecated
*
* @param string $charset
}
}
- /**
- * xml parser handler function for opening element tags.
- * Used in decoding xml chunks that might represent single xml-rpc values as well as requests, responses.
- * @deprecated
- *
- * @param resource $parser
- * @param $name
- * @param $attrs
- * @return void
- */
- public function xmlrpc_se_any($parser, $name, $attrs)
- {
- // avoid spamming the log with warnings in case this is in use...
- //$this->logDeprecation('Method ' . __METHOD__ . ' is deprecated');
-
- $this->xmlrpc_se($parser, $name, $attrs, true);
- }
-
/**
* xml parser handler function for close element tags.
* @internal
/**
* xml parser handler function for 'other stuff', i.e. not char data or element start/end tag.
- * In fact it only gets called on unknown entities...
+ * In fact, it only gets called on unknown entities...
* @internal
*
* @param $parser
return $data;
}
- // BC layer
+ // *** BC layer ***
+
+ /**
+ * xml parser handler function for opening element tags.
+ * Used in decoding xml chunks that might represent single xml-rpc values as well as requests, responses.
+ * @deprecated
+ *
+ * @param resource $parser
+ * @param $name
+ * @param $attrs
+ * @return void
+ */
+ public function xmlrpc_se_any($parser, $name, $attrs)
+ {
+ // this will be spamming the log if this method is in use...
+ $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated');
+
+ $this->xmlrpc_se($parser, $name, $attrs, true);
+ }
public function __set($name, $value)
{
break;
default:
/// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
}
}
break;
default:
/// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
}
}
*/
public static $xmlrpc_silence_deprecations = true;
+ // *** BC layer ***
+
+ /**
+ * Inject a logger into all classes of the PhpXmlRpc library which use one
+ *
+ * @param $logger
+ * @return void
+ */
+ public static function setLogger($logger)
+ {
+ Charset::setLogger($logger);
+ Client::setLogger($logger);
+ Encoder::setLogger($logger);
+ Http::setLogger($logger);
+ Request::setLogger($logger);
+ Server::setLogger($logger);
+ Value::setLogger($logger);
+ Wrapper::setLogger($logger);
+ XMLParser::setLogger($logger);
+ }
+
+ /**
+ * Makes the library use the error codes detailed at https://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
+ *
+ * @return void
+ *
+ * @tofo feature creep - allow switching back to the original set of codes; querying the current mode
+ */
+ public static function useInteropFaults()
+ {
+ self::$xmlrpcerr = Interop::$xmlrpcerr;
+
+ self::$xmlrpcerruser = -Interop::$xmlrpcerruser;
+ }
+
/**
* A function to be used for compatibility with legacy code: it creates all global variables which used to be declared,
* such as library version etc...
}
}
}
-
- /**
- * Inject a logger into all classes of the PhpXmlRpc library which use one
- *
- * @param $logger
- * @return void
- */
- public static function setLogger($logger)
- {
- Charset::setLogger($logger);
- Client::setLogger($logger);
- Encoder::setLogger($logger);
- Http::setLogger($logger);
- Request::setLogger($logger);
- Server::setLogger($logger);
- Value::setLogger($logger);
- Wrapper::setLogger($logger);
- XMLParser::setLogger($logger);
- }
-
- /**
- * Makes the library use the error codes detailed at https://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
- *
- * @return void
- *
- * @tofo feature creep - allow switching back to the original set of codes; querying the current mode
- */
- public static function useInteropFaults()
- {
- self::$xmlrpcerr = Interop::$xmlrpcerr;
-
- self::$xmlrpcerruser = -Interop::$xmlrpcerruser;
- }
}
return $result;
}
- // BC layer
+ // *** BC layer ***
// we have to make this return by ref in order to allow calls such as `$resp->_cookies['name'] = ['value' => 'something'];`
public function &__get($name)
return $this->httpResponse['raw_data'];
default:
/// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
return null;
}
break;
default:
/// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
}
}
break;
default:
/// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
}
}