File: 11-php84_support_E_STRICT.patch

package info (click to toggle)
php-codeigniter-framework 3.1.13%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,228 kB
  • sloc: php: 37,178; xml: 205; makefile: 138; python: 66; sh: 65
file content (54 lines) | stat: -rw-r--r-- 1,733 bytes parent folder | download | duplicates (2)
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
50
51
52
53
54
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__));