more deprecations; docs
authorgggeek <giunta.gaetano@gmail.com>
Thu, 2 Feb 2023 08:29:02 +0000 (08:29 +0000)
committergggeek <giunta.gaetano@gmail.com>
Thu, 2 Feb 2023 08:29:02 +0000 (08:29 +0000)
NEWS.md
src/Client.php
src/Request.php
src/Response.php
src/Server.php
tests/08ServerTest.php

diff --git a/NEWS.md b/NEWS.md
index 2c45e04..60f1cfa 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -65,6 +65,8 @@
 * fixed: setting values to deprecated Response property `cookies` would trigger a PHP notice, ex:
   `$response->_cookies['name'] = ['value' => 'something'];` (introduced in 4.6.0)
 
+* fixed: made deprecated method `Value::structEach` work again with php 8.0 and later
+
 * new: method `PhpXmlRpc::useInteropFaults()` can be used to make the library change the error codes it generates to
   match the spec described at https://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
 
index 4982222..d10938b 100644 (file)
@@ -1079,6 +1079,7 @@ class Client
 
         // Only create the payload if it was not created previously
         /// @todo what if the request's payload was created with a different encoding?
+        ///       Also, if we do not call serialize(), the request will not set its content-type to have the charset declared
         if (empty($req->payload)) {
             $req->serialize($opts['request_charset_encoding']);
         }
index b291065..7f177b0 100644 (file)
@@ -74,18 +74,21 @@ class Request
     }
 
     /**
-     * @internal this function will become protected in the future
+     * @internal this function will become protected in the future (and be folded into serialize)
      *
      * @param string $charsetEncoding
      * @return void
      */
     public function createPayload($charsetEncoding = '')
     {
+        $this->logDeprecationUnlessCalledBy('serialize');
+
         if ($charsetEncoding != '') {
             $this->content_type = 'text/xml; charset=' . $charsetEncoding;
         } else {
             $this->content_type = 'text/xml';
         }
+
         $this->payload = $this->xml_header($charsetEncoding);
         $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities(
             $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
index 2147179..2665e99 100644 (file)
@@ -32,6 +32,7 @@ class Response
     public $payload;
     /** @var string */
     public $content_type = 'text/xml';
+
     protected $httpResponse = array('headers' => array(), 'cookies' => array(), 'raw_data' => '', 'status_code' => null);
 
     /**
@@ -156,6 +157,7 @@ class Response
         } else {
             $this->content_type = 'text/xml';
         }
+
         if (PhpXmlRpc::$xmlrpc_null_apache_encoding) {
             $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n";
         } else {
@@ -184,6 +186,7 @@ class Response
             }
         }
         $result .= "\n</methodResponse>";
+
         $this->payload = $result;
 
         return $result;
index cbbb1e1..16c6253 100644 (file)
@@ -406,6 +406,7 @@ class Server
 
         // Do not create response serialization if it has already happened. Helps to build json magic
         /// @todo what if the payload was created targeting a different charset than $respCharset?
+        ///       Also, if we do not call serialize(), the request will not set its content-type to have the charset declared
         if (empty($resp->payload)) {
             $resp->serialize($respCharset);
         }
index 6f9f976..69068e7 100644 (file)
@@ -1006,7 +1006,7 @@ And turned it into nylon';
         $this->assertEquals('200', $h['status_code']);
         $this->assertNotEmpty($h['headers']);
 
-        $d = $this->client->debug;
+        $d = $this->client->getOption('debug');
         $this->client->setDebug(-1);
         $v2 = $this->send($m, 0, true);
         $this->client->setDebug($d);