summaryrefslogtreecommitdiffstats
path: root/debian/patches/02-fix-deprecated-xml_set_-calls-php8.4.patch
blob: c399430ee9ac50a085a04e0b22a19047e05902b1 (plain)
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
From 15bc2183654e230658b1bd7f155e0b21d1539d71 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Mon, 25 Nov 2024 14:50:44 +0100
Subject: [PATCH] fix deprecated xml_set_* calls
Origin: https://github.com/kissifrot/php-ixr/pull/12

Instead of first setting the handler object and then passing the
handlers as strings, handlers should be set via proper callables.
The old method has been deprecated in PHP 8.4
---
 src/Message/Message.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/Message/Message.php b/src/Message/Message.php
index d932431..8203e37 100644
--- a/src/Message/Message.php
+++ b/src/Message/Message.php
@@ -65,9 +65,8 @@ public function parse()
         // Set XML parser to take the case of tags in to account
         xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
         // Set XML parser callback functions
-        xml_set_object($this->_parser, $this);
-        xml_set_element_handler($this->_parser, 'tagOpen', 'tagClose');
-        xml_set_character_data_handler($this->_parser, 'cdata');
+        xml_set_element_handler($this->_parser, [$this, 'tagOpen'], [$this, 'tagClose']);
+        xml_set_character_data_handler($this->_parser, [$this, 'cdata']);
         $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages
         $final = false;
         do {