Source: php-codeigniter-framework
Version: 3.1.13+dfsg1-2
Severity: normal
Tags: patch
X-Debbugs-Cc: athos.ribe...@canonical.com

Dear Maintainer,

This package currently FTBFS with php8.3 (in experimental).

A fix is available in codeigniter4 at
https://github.com/codeigniter4/CodeIgniter4/commit/a412fff274947b14d341e59d593d8ebd9cb8d26e

I am attaching a backport of that patch here to provide a fix for v3.
>From a412fff274947b14d341e59d593d8ebd9cb8d26e Mon Sep 17 00:00:00 2001
From: kenjis <kenji....@gmail.com>
Date: Fri, 8 Sep 2023 10:37:07 +0900
Subject: [PATCH] test: update expectation for highlight code in PHP 8.3

Origin: backport, 
https://github.com/codeigniter4/CodeIgniter4/commit/a412fff274947b14d341e59d593d8ebd9cb8d26e
---
 tests/system/Helpers/TextHelperTest.php |  9 ++++++++-
 tests/system/View/ParserFilterTest.php  | 16 ++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

--- a/tests/codeigniter/helpers/text_helper_test.php
+++ b/tests/codeigniter/helpers/text_helper_test.php
@@ -101,7 +101,14 @@
 
        public function test_highlight_code()
        {
-               $expect = "<code><span style=\"color: #000000\">\n<span 
style=\"color: #0000BB\">&lt;?php&nbsp;var_dump</span><span style=\"color: 
#007700\">(</span><span style=\"color: #0000BB\">\$this</span><span 
style=\"color: #007700\">);&nbsp;</span><span style=\"color: 
#0000BB\">?&gt;&nbsp;</span>\n</span>\n</code>";
+        // PHP 8.3 changes the output.
+        if (version_compare(PHP_VERSION, '8.3', '<')) {
+            $expect = "<code><span style=\"color: #000000\">\n<span 
style=\"color: #0000BB\">&lt;?php&nbsp;var_dump</span><span style=\"color: 
#007700\">(</span><span style=\"color: #0000BB\">\$this</span><span 
style=\"color: #007700\">);&nbsp;</span><span style=\"color: 
#0000BB\">?&gt;&nbsp;</span>\n</span>\n</code>";
+        } else {
+            // PHP 8.3
+            $expect = '<pre><code style="color: #000000"><span style="color: 
#0000BB">&lt;?php var_dump</span><span style="color: #007700">(</span><span 
style="color: #0000BB">$this</span><span style="color: #007700">); </span><span 
style="color: #0000BB">?&gt; ?&gt;</span></code></pre>';
+        }
+
 
                $this->assertEquals($expect, highlight_code('<?php 
var_dump($this); ?>'));
        }

Reply via email to