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:
+21
-19
@@ -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
|
||||
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Output
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/user_guide/libraries/output.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/output.html
|
||||
*/
|
||||
class CI_Output {
|
||||
|
||||
@@ -55,7 +56,7 @@ class CI_Output {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $final_output;
|
||||
public $final_output = '';
|
||||
|
||||
/**
|
||||
* Cache expiration time
|
||||
@@ -145,7 +146,7 @@ class CI_Output {
|
||||
&& extension_loaded('zlib')
|
||||
);
|
||||
|
||||
isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
|
||||
isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
|
||||
|
||||
// Get mime types for later
|
||||
$this->mimes =& get_mimes();
|
||||
@@ -299,10 +300,14 @@ class CI_Output {
|
||||
*/
|
||||
public function get_header($header)
|
||||
{
|
||||
// Combine headers already sent with our batched headers
|
||||
// We only need [x][0] from our multi-dimensional array
|
||||
$header_lines = array_map(function ($headers)
|
||||
{
|
||||
return array_shift($headers);
|
||||
}, $this->headers);
|
||||
|
||||
$headers = array_merge(
|
||||
// We only need [x][0] from our multi-dimensional array
|
||||
array_map('array_shift', $this->headers),
|
||||
$header_lines,
|
||||
headers_list()
|
||||
);
|
||||
|
||||
@@ -412,7 +417,7 @@ class CI_Output {
|
||||
* @param string $output Output data override
|
||||
* @return void
|
||||
*/
|
||||
public function _display($output = '')
|
||||
public function _display($output = NULL)
|
||||
{
|
||||
// Note: We use load_class() because we can't use $CI =& get_instance()
|
||||
// since this function is sometimes called by the caching mechanism,
|
||||
@@ -429,7 +434,7 @@ class CI_Output {
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Set the output data
|
||||
if ($output === '')
|
||||
if ($output === NULL)
|
||||
{
|
||||
$output =& $this->final_output;
|
||||
}
|
||||
@@ -451,7 +456,7 @@ class CI_Output {
|
||||
|
||||
$elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
|
||||
|
||||
if ($this->parse_exec_vars === TRUE)
|
||||
if ($this->parse_exec_vars === TRUE && !empty($output))
|
||||
{
|
||||
$memory = round(memory_get_usage() / 1024 / 1024, 2).'MB';
|
||||
$output = str_replace(array('{elapsed_time}', '{memory_usage}'), array($elapsed, $memory), $output);
|
||||
@@ -502,7 +507,7 @@ class CI_Output {
|
||||
|
||||
echo $output;
|
||||
log_message('info', 'Final output sent to browser');
|
||||
log_message('debug', 'Total execution time: '.$elapsed);
|
||||
log_message('info', 'Total execution time: '.$elapsed);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -539,7 +544,7 @@ class CI_Output {
|
||||
}
|
||||
|
||||
log_message('info', 'Final output sent to browser');
|
||||
log_message('debug', 'Total execution time: '.$elapsed);
|
||||
log_message('info', 'Total execution time: '.$elapsed);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -554,7 +559,7 @@ class CI_Output {
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$path = $CI->config->item('cache_path');
|
||||
$cache_path = ($path === '') ? APPPATH.'cache/' : $path;
|
||||
$cache_path = ($path === '') ? APPPATH.'cache'.DIRECTORY_SEPARATOR : rtrim($path, '/\\').DIRECTORY_SEPARATOR;
|
||||
|
||||
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
|
||||
{
|
||||
@@ -563,7 +568,7 @@ class CI_Output {
|
||||
}
|
||||
|
||||
$uri = $CI->config->item('base_url')
|
||||
.$CI->config->item('index_page')
|
||||
.$CI->config->slash_item('index_page')
|
||||
.$CI->uri->uri_string();
|
||||
|
||||
if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
|
||||
@@ -658,7 +663,7 @@ class CI_Output {
|
||||
$cache_path = ($CFG->item('cache_path') === '') ? APPPATH.'cache/' : $CFG->item('cache_path');
|
||||
|
||||
// Build the file path. The file name is an MD5 hash of the full URI
|
||||
$uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string;
|
||||
$uri = $CFG->item('base_url').$CFG->slash_item('index_page').$URI->uri_string;
|
||||
|
||||
if (($cache_query_string = $CFG->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
|
||||
{
|
||||
@@ -761,7 +766,7 @@ class CI_Output {
|
||||
}
|
||||
}
|
||||
|
||||
$cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').ltrim($uri, '/'));
|
||||
$cache_path .= md5($CI->config->item('base_url').$CI->config->slash_item('index_page').ltrim($uri, '/'));
|
||||
|
||||
if ( ! @unlink($cache_path))
|
||||
{
|
||||
@@ -829,9 +834,6 @@ class CI_Output {
|
||||
{
|
||||
if (self::$func_overload)
|
||||
{
|
||||
// mb_substr($str, $start, null, '8bit') returns an empty
|
||||
// string on PHP 5.3
|
||||
isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start);
|
||||
return mb_substr($str, $start, $length, '8bit');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user