CodeIgniter 3.1.11 -> 3.4.5 (pocketarc fork) en PHP 8.3-fixes

- system/ vervangen door CodeIgniter 3.4.5 (pocketarc/codeigniter, PHP 8.2-8.5 compatibel)
- config.php, mimes.php, user_agents.php en error-views bijgewerkt naar 3.4.5
- composer.json: php-constraint "^7.4 || ^8.0" zodat composer install op 8.3 werkt
- PHP 8-fatals opgelost: count()/array-functies op FALSE/null, rekenen met lege
  strings, delen door nul, property zetten op FALSE, curly-brace string offsets,
  ongedefinieerde constanten, foute curl_setopt in Phantom_model::create_img
- dynamic properties gedeclareerd in libraries, optionele parameters voor verplichte opgelost
- vergelijkingen waar '' == 0 in PHP 8 anders uitvalt gecast naar (int)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 09:34:46 +02:00
co-authored by Claude Opus 5.5
parent c6afbb01f2
commit 172fcf566c
284 changed files with 3497 additions and 3718 deletions
+72 -12
View File
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Image_lib
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/image_lib.html
* @link https://codeigniter.com/userguide3/libraries/image_lib.html
*/
class CI_Image_lib {
@@ -84,6 +85,14 @@ class CI_Image_lib {
*/
public $new_image = '';
/**
* Path to destination image
*
* @var string
*/
public $dest_image = '';
/**
* Image width
*
@@ -832,8 +841,11 @@ class CI_Image_lib {
}
// Kill the file handles
imagedestroy($dst_img);
imagedestroy($src_img);
if (PHP_VERSION_ID < 80000)
{
imagedestroy($dst_img);
imagedestroy($src_img);
}
if ($this->dynamic_output !== TRUE)
{
@@ -946,6 +958,10 @@ class CI_Image_lib {
$cmd_in = 'pngtopnm';
$cmd_out = 'ppmtopng';
break;
case 18 :
$cmd_in = 'webptopnm';
$cmd_out = 'ppmtowebp';
break;
}
if ($action === 'crop')
@@ -1037,8 +1053,11 @@ class CI_Image_lib {
}
// Kill the file handles
imagedestroy($dst_img);
imagedestroy($src_img);
if (PHP_VERSION_ID < 80000)
{
imagedestroy($dst_img);
imagedestroy($src_img);
}
chmod($this->full_dst_path, $this->file_permissions);
@@ -1116,7 +1135,10 @@ class CI_Image_lib {
}
// Kill the file handles
imagedestroy($src_img);
if (PHP_VERSION_ID < 80000)
{
imagedestroy($src_img);
}
chmod($this->full_dst_path, $this->file_permissions);
@@ -1207,7 +1229,7 @@ class CI_Image_lib {
}
// Build the finalized image
if ($wm_img_type === 3 && function_exists('imagealphablending'))
if ($wm_img_type === 3)
{
@imagealphablending($src_img, TRUE);
}
@@ -1246,8 +1268,11 @@ class CI_Image_lib {
return FALSE;
}
imagedestroy($src_img);
imagedestroy($wm_img);
if (PHP_VERSION_ID < 80000)
{
imagedestroy($src_img);
imagedestroy($wm_img);
}
return TRUE;
}
@@ -1417,7 +1442,10 @@ class CI_Image_lib {
$this->image_save_gd($src_img);
}
imagedestroy($src_img);
if (PHP_VERSION_ID < 80000)
{
imagedestroy($src_img);
}
return TRUE;
}
@@ -1472,6 +1500,14 @@ class CI_Image_lib {
}
return imagecreatefrompng($path);
case 18:
if ( ! function_exists('imagecreatefromwebp'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported'));
return FALSE;
}
return imagecreatefromwebp($path);
default:
$this->set_error(array('imglib_unsupported_imagecreate'));
return FALSE;
@@ -1532,6 +1568,19 @@ class CI_Image_lib {
return FALSE;
}
break;
case 18:
if ( ! function_exists('imagewebp'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported'));
return FALSE;
}
if ( ! @imagewebp($resource, $this->full_dst_path))
{
$this->set_error('imglib_save_failed');
return FALSE;
}
break;
default:
$this->set_error(array('imglib_unsupported_imagecreate'));
return FALSE;
@@ -1551,7 +1600,16 @@ class CI_Image_lib {
*/
public function image_display_gd($resource)
{
header('Content-Disposition: filename='.$this->source_image.';');
// RFC 6266 allows for multibyte filenames, but only in UTF-8,
// so we have to make it conditional ...
$filename = basename(empty($this->new_image) ? $this->source_image : $this->new_image);
$charset = strtoupper(config_item('charset'));
$utf8_filename = ($charset !== 'UTF-8')
? get_instance()->utf8->convert_to_utf8($filename, $charset)
: $filename;
isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename);
header('Content-Disposition: filename="'.$filename.'";'.$utf8_filename);
header('Content-Type: '.$this->mime_type);
header('Content-Transfer-Encoding: binary');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
@@ -1564,6 +1622,8 @@ class CI_Image_lib {
break;
case 3 : imagepng($resource);
break;
case 18 : imagewebp($resource);
break;
default: echo 'Unable to display the image';
break;
}