Description: remove deprecation notice on php8.4 for E_STRICT
From 831108645a2b68150471035a7e5ced5086da2c51 Mon Sep 17 00:00:00 2001
From: Bruno Moreira <git@pocketarc.com>
From: Fab Stz <fabstz-it@yahoo.fr>
Origin: https://github.com/pocketarc/codeigniter/commit/831108645a2b68150471035a7e5ced5086da2c51
Date: Tue, 29 Oct 2024 06:12:23 -0600
Bug: https://github.com/bcit-ci/CodeIgniter/issues/6301

--- a/index.php
+++ b/index.php
@@ -73,7 +73,11 @@
 	case 'testing':
 	case 'production':
 		ini_set('display_errors', 0);
-		if (version_compare(PHP_VERSION, '5.3', '>='))
+		if (version_compare(PHP_VERSION, '8.4', '>='))
+		{
+			error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
+		}
+		else if (version_compare(PHP_VERSION, '5.3', '>='))
 		{
 			error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
 		}
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -73,7 +73,11 @@
 		E_USER_ERROR		=>	'User Error',
 		E_USER_WARNING		=>	'User Warning',
 		E_USER_NOTICE		=>	'User Notice',
-		E_STRICT		=>	'Runtime Notice'
+
+		# 2048 is E_STRICT, but it's deprecated in PHP 8.4.
+		# We're keeping this here for backwards compatibility.
+		# If we're on older PHP, E_STRICT errors will be labelled correctly, and if we're on PHP 8.4+, this will be ignored.
+		2048		=>	'Runtime Notice'
 	);
 
 	/**
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -1,7 +1,12 @@
 <?php
 // Errors on full!
 ini_set('display_errors', 1);
-error_reporting(E_ALL | E_STRICT);
+
+if (version_compare(PHP_VERSION, '8.4', '>=')) {
+	error_reporting(E_ALL);
+} else {
+	error_reporting(E_ALL | E_STRICT);
+}
 
 $dir = realpath(dirname(__FILE__));
 
