CodeIgniter icon indicating copy to clipboard operation
CodeIgniter copied to clipboard

php 8.4: Constant E_STRICT is deprecated

Open tenzap opened this issue 1 year ago • 2 comments

I was trying to use CI3 with PHP8.4. I'm facing this error:

Deprecated: Constant E_STRICT is deprecated in .../vendor/codeigniter/framework/system/core/Exceptions.php on line 76
A PHP Error was encountered

Severity: 8192

Message: Constant E_STRICT is deprecated

Filename: core/Exceptions.php

Line Number: 76

tenzap avatar Sep 29 '24 06:09 tenzap

Since you often use different versions of PHP You can try using the Servbay tool, which supports PHP8.4beta, without worrying about environmental pollution.

@corrosive4354 thanks for the "tip"... Since I maintain the ci3 package in Debian, I'd prefer to use pure debian packages to switch between php versions. They are provided by debian's php maintainer on his specific repo at https://deb.sury.org/. This ensures pure debian experience and not messing my system up with any sort of other packages not integrating well into debian.

tenzap avatar Nov 01 '24 21:11 tenzap

You can replace the array in the system\core\Exceptions.php with the below

/**
 * List of available error levels
 *
 * @var	array
 */
public $levels = array(
	E_ERROR				=>	'Error',
	E_WARNING			=>	'Warning',
	E_PARSE				=>	'Parsing Error',
	E_NOTICE			=>	'Notice',
	E_CORE_ERROR		=>	'Core Error',
	E_CORE_WARNING		=>	'Core Warning',
	E_COMPILE_ERROR		=>	'Compile Error',
	E_COMPILE_WARNING	=>	'Compile Warning',
	E_DEPRECATED		=>	'Core Depreciated',
	E_USER_ERROR		=>	'User Error',
	E_USER_WARNING		=>	'User Warning',
	E_USER_NOTICE		=>	'User Notice',
	E_USER_DEPRECATED	=>	'User Depreciated'
);

You probably also need to remove

~E_STRICT

In your index.php if you're using it.

rhickmott avatar Jan 06 '25 16:01 rhickmott