Skip to content

Commit

Permalink
Merge pull request #391 from kenjis/1.x-update-to-ci-3.1.13
Browse files Browse the repository at this point in the history
[1.x] Update CI replacement files to v3.1.13
  • Loading branch information
kenjis authored Mar 17, 2022
2 parents e59875e + 001e6f1 commit 9a94f8c
Show file tree
Hide file tree
Showing 24 changed files with 6,000 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ matrix:
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4
- php: 7.4.22

env:
global:
Expand Down
6 changes: 6 additions & 0 deletions application/tests/_ci_phpunit_test/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log for ci-phpunit-test

## v1.0.2 (Not Released)

### Others

* Compatible with CodeIgniter 3.1.13

## v1.0.1 (2021/07/14)

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -46,7 +47,7 @@
* @subpackage CodeIgniter
* @category Front-controller
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/
* @link https://codeigniter.com/userguide3/
*/

/**
Expand All @@ -55,7 +56,7 @@
* @var string
*
*/
const CI_VERSION = '3.1.10';
const CI_VERSION = '3.1.13';

/*
* ------------------------------------------------------
Expand Down Expand Up @@ -456,14 +457,14 @@ function &get_instance()
* ReflectionMethod::isConstructor() is the ONLY reliable check,
* knowing which method will be executed as a constructor.
*/
elseif ( ! is_callable(array($class, $method)))
else
{
$reflection = new ReflectionMethod($class, $method);
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
{
$e404 = TRUE;
}
}
}
}

if ($e404)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function set_status_header($code = 200, $text = '')
return;
}

$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
}
Expand Down
55 changes: 49 additions & 6 deletions application/tests/_ci_phpunit_test/replacing/core/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -46,7 +47,7 @@
* @subpackage Libraries
* @category Input
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/input.html
* @link https://codeigniter.com/userguide3/libraries/input.html
*/
class CI_Input {

Expand Down Expand Up @@ -375,16 +376,17 @@ public function input_stream($index = NULL, $xss_clean = NULL)
* @param string $prefix Cookie name prefix
* @param bool $secure Whether to only transfer cookies via SSL
* @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
* @param string $samesite SameSite attribute
* @return void
*
* modified by ci-phpunit-test
*/
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
{
if (is_array($name))
{
// always leave 'name' in last place, as the loop will break otherwise, due to $$item
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item)
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name', 'samesite') as $item)
{
if (isset($name[$item]))
{
Expand Down Expand Up @@ -425,7 +427,47 @@ public function set_cookie($name, $value = '', $expire = '', $domain = '', $path
$expire = ($expire > 0) ? time() + $expire : 0;
}

// setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly);
isset($samesite) OR $samesite = config_item('cookie_samesite');
if (isset($samesite))
{
$samesite = ucfirst(strtolower($samesite));
in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax';
}
else
{
$samesite = 'Lax';
}

if ($samesite === 'None' && ! $secure)
{
log_message('error', $name.' cookie sent with SameSite=None, but without Secure attribute.');
}

if ( ! is_php('7.3'))
{
$maxage = $expire - time();
if ($maxage < 1)
{
$maxage = 0;
}

$cookie_header = 'Set-Cookie: '.$prefix.$name.'='.rawurlencode($value);
$cookie_header .= ($expire === 0 ? '' : '; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)).'; Max-Age='.$maxage;
$cookie_header .= '; Path='.$path.($domain !== '' ? '; Domain='.$domain : '');
$cookie_header .= ($secure ? '; Secure' : '').($httponly ? '; HttpOnly' : '').'; SameSite='.$samesite;
// header($cookie_header);
// return;
}

$setcookie_options = array(
'expires' => $expire,
'path' => $path,
'domain' => $domain,
'secure' => $secure,
'httponly' => $httponly,
'samesite' => $samesite,
);
// setcookie($prefix.$name, $value, $setcookie_options);

// Save cookie in Output object
// added by ci-phpunit-test
Expand All @@ -438,6 +480,7 @@ public function set_cookie($name, $value = '', $expire = '', $domain = '', $path
'domain' => $domain,
'secure' => $secure,
'httponly' => $httponly,
'samesite' => $samesite,
];
}

Expand Down Expand Up @@ -602,7 +645,7 @@ public function valid_ip($ip, $which = '')
$which = FILTER_FLAG_IPV6;
break;
default:
$which = NULL;
$which = 0;
break;
}

Expand Down
5 changes: 3 additions & 2 deletions application/tests/_ci_phpunit_test/replacing/core/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -46,7 +47,7 @@
* @subpackage Libraries
* @category Loader
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/loader.html
* @link https://codeigniter.com/userguide3/libraries/loader.html
*/
class CI_Loader {

Expand Down
9 changes: 5 additions & 4 deletions application/tests/_ci_phpunit_test/replacing/core/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -46,7 +47,7 @@
* @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 {

Expand All @@ -55,7 +56,7 @@ class CI_Output {
*
* @var string
*/
public $final_output;
public $final_output = '';

/**
* Cache expiration time
Expand Down Expand Up @@ -163,7 +164,7 @@ public function __construct()
&& 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();
Expand Down

This file was deleted.

Loading

0 comments on commit 9a94f8c

Please sign in to comment.