1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
From cb5487171e7a883f4a0c6346ef0efb8ee7acb2bf Mon Sep 17 00:00:00 2001
From: Niel Buys <nbuys@ncomp.co.za>
Date: Fri, 20 Dec 2024 15:32:22 +0200
Subject: [PATCH] Fix PHP 8.4 deprecated warnings Github issue 6306
Origin: https://github.com/NielBuys/CodeIgniter/pull/2/commits/cb5487171e7a883f4a0c6346ef0efb8ee7acb2bf
Origin: https://github.com/NielBuys/CodeIgniter/pull/2/commits/6a139066bcebf03026ac0b9f0f3f2b548c73aa22
--- a/tests/mocks/libraries/xmlrpcs.php
+++ b/tests/mocks/libraries/xmlrpcs.php
@@ -10,6 +10,15 @@
{
$r = $this->parseRequest();
+ if (isset($r->method_name) && isset($this->config['functions'][$r->method_name])) {
+ $callback = $this->config['functions'][$r->method_name]['function'];
+ if (is_callable($callback)) {
+ call_user_func($callback, $r->parameters);
+ } else {
+ throw new Exception('Invalid callback: ' . $callback);
+ }
+ }
+
$payload = '<?xml version="1.0" encoding="'.$this->xmlrpc_defencoding.'"?'.'>'."\n".$this->debug_msg.$r->prepare_response();
$this->mock_payload = "HTTP/1.1 200 OK\r\n";
@@ -20,4 +29,23 @@
$this->mock_payload .= $payload;
}
+
+ /**
+ * Mock XML request (example)
+ */
+ public function xml_request()
+ {
+ // Return a mock XML request
+ return '<?xml version="1.0"?>
+ <methodCall>
+ <methodName>Testmethod</methodName>
+ <params>
+ <param>
+ <value>
+ <string>Test</string>
+ </value>
+ </param>
+ </params>
+ </methodCall>';
+ }
}
|