From 6b75f341ad54bdc8c7333acecd0ca435a07b2086 Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Mon, 2 Jan 2023 14:24:57 +0100 Subject: [PATCH] #4938: Workaround for PHP 8.2.0 segmentation fault / assertion error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Casting a `SimpleXMLElement` to an array should be equivalent to `get_object_vars(…)` as far as I can tell. At least all existing tests pass and I don't see any visual regressions upon making this change. By replacing `get_object_vars(…)` with a cast to array, we sidestep this PHP 8.2.0 bug: https://github.com/php/php-src/issues/10200 Fixes: https://github.com/e107inc/e107/issues/4938 --- e107_handlers/xml_class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index 16adeb0f26..10a5d57f16 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -549,7 +549,7 @@ function xml2array($xml, $rec_parent = '') $ret = array(); - $tags = get_object_vars($xml); + $tags = (array) $xml; //remove comments