Skip to content

Commit 001e6f1

Browse files
committed
Merge pull request #390 from kenjis/2.x-update-to-ci-3.1.13
[2.x] Update CI replacement files to v3.1.13
1 parent e59875e commit 001e6f1

24 files changed

+6000
-32
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ matrix:
1111
- php: 7.1
1212
- php: 7.2
1313
- php: 7.3
14-
- php: 7.4
14+
- php: 7.4.22
1515

1616
env:
1717
global:

application/tests/_ci_phpunit_test/ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log for ci-phpunit-test
22

3+
## v1.0.2 (Not Released)
4+
5+
### Others
6+
7+
* Compatible with CodeIgniter 3.1.13
8+
39
## v1.0.1 (2021/07/14)
410

511
### Fixed

application/tests/_ci_phpunit_test/replacing/core/CodeIgniter.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* This content is released under the MIT License (MIT)
88
*
9-
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
9+
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
1010
*
1111
* Permission is hereby granted, free of charge, to any person obtaining a copy
1212
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
3030
* @author EllisLab Dev Team
3131
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
3232
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
33+
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
3334
* @license https://opensource.org/licenses/MIT MIT License
3435
* @link https://codeigniter.com
3536
* @since Version 1.0.0
@@ -46,7 +47,7 @@
4647
* @subpackage CodeIgniter
4748
* @category Front-controller
4849
* @author EllisLab Dev Team
49-
* @link https://codeigniter.com/user_guide/
50+
* @link https://codeigniter.com/userguide3/
5051
*/
5152

5253
/**
@@ -55,7 +56,7 @@
5556
* @var string
5657
*
5758
*/
58-
const CI_VERSION = '3.1.10';
59+
const CI_VERSION = '3.1.13';
5960

6061
/*
6162
* ------------------------------------------------------
@@ -456,14 +457,14 @@ function &get_instance()
456457
* ReflectionMethod::isConstructor() is the ONLY reliable check,
457458
* knowing which method will be executed as a constructor.
458459
*/
459-
elseif ( ! is_callable(array($class, $method)))
460+
else
460461
{
461462
$reflection = new ReflectionMethod($class, $method);
462463
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
463464
{
464465
$e404 = TRUE;
465466
}
466-
}
467+
}
467468
}
468469

469470
if ($e404)

application/tests/_ci_phpunit_test/replacing/core/Common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ function set_status_header($code = 200, $text = '')
312312
return;
313313
}
314314

315-
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
315+
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
316316
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
317317
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
318318
}

application/tests/_ci_phpunit_test/replacing/core/Input.php

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* This content is released under the MIT License (MIT)
88
*
9-
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
9+
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
1010
*
1111
* Permission is hereby granted, free of charge, to any person obtaining a copy
1212
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
3030
* @author EllisLab Dev Team
3131
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
3232
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
33+
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
3334
* @license https://opensource.org/licenses/MIT MIT License
3435
* @link https://codeigniter.com
3536
* @since Version 1.0.0
@@ -46,7 +47,7 @@
4647
* @subpackage Libraries
4748
* @category Input
4849
* @author EllisLab Dev Team
49-
* @link https://codeigniter.com/user_guide/libraries/input.html
50+
* @link https://codeigniter.com/userguide3/libraries/input.html
5051
*/
5152
class CI_Input {
5253

@@ -375,16 +376,17 @@ public function input_stream($index = NULL, $xss_clean = NULL)
375376
* @param string $prefix Cookie name prefix
376377
* @param bool $secure Whether to only transfer cookies via SSL
377378
* @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
379+
* @param string $samesite SameSite attribute
378380
* @return void
379381
*
380382
* modified by ci-phpunit-test
381383
*/
382-
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
384+
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
383385
{
384386
if (is_array($name))
385387
{
386388
// always leave 'name' in last place, as the loop will break otherwise, due to $$item
387-
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item)
389+
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name', 'samesite') as $item)
388390
{
389391
if (isset($name[$item]))
390392
{
@@ -425,7 +427,47 @@ public function set_cookie($name, $value = '', $expire = '', $domain = '', $path
425427
$expire = ($expire > 0) ? time() + $expire : 0;
426428
}
427429

428-
// setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly);
430+
isset($samesite) OR $samesite = config_item('cookie_samesite');
431+
if (isset($samesite))
432+
{
433+
$samesite = ucfirst(strtolower($samesite));
434+
in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax';
435+
}
436+
else
437+
{
438+
$samesite = 'Lax';
439+
}
440+
441+
if ($samesite === 'None' && ! $secure)
442+
{
443+
log_message('error', $name.' cookie sent with SameSite=None, but without Secure attribute.');
444+
}
445+
446+
if ( ! is_php('7.3'))
447+
{
448+
$maxage = $expire - time();
449+
if ($maxage < 1)
450+
{
451+
$maxage = 0;
452+
}
453+
454+
$cookie_header = 'Set-Cookie: '.$prefix.$name.'='.rawurlencode($value);
455+
$cookie_header .= ($expire === 0 ? '' : '; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)).'; Max-Age='.$maxage;
456+
$cookie_header .= '; Path='.$path.($domain !== '' ? '; Domain='.$domain : '');
457+
$cookie_header .= ($secure ? '; Secure' : '').($httponly ? '; HttpOnly' : '').'; SameSite='.$samesite;
458+
// header($cookie_header);
459+
// return;
460+
}
461+
462+
$setcookie_options = array(
463+
'expires' => $expire,
464+
'path' => $path,
465+
'domain' => $domain,
466+
'secure' => $secure,
467+
'httponly' => $httponly,
468+
'samesite' => $samesite,
469+
);
470+
// setcookie($prefix.$name, $value, $setcookie_options);
429471

430472
// Save cookie in Output object
431473
// added by ci-phpunit-test
@@ -438,6 +480,7 @@ public function set_cookie($name, $value = '', $expire = '', $domain = '', $path
438480
'domain' => $domain,
439481
'secure' => $secure,
440482
'httponly' => $httponly,
483+
'samesite' => $samesite,
441484
];
442485
}
443486

@@ -602,7 +645,7 @@ public function valid_ip($ip, $which = '')
602645
$which = FILTER_FLAG_IPV6;
603646
break;
604647
default:
605-
$which = NULL;
648+
$which = 0;
606649
break;
607650
}
608651

application/tests/_ci_phpunit_test/replacing/core/Loader.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* This content is released under the MIT License (MIT)
88
*
9-
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
9+
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
1010
*
1111
* Permission is hereby granted, free of charge, to any person obtaining a copy
1212
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
3030
* @author EllisLab Dev Team
3131
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
3232
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
33+
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
3334
* @license https://opensource.org/licenses/MIT MIT License
3435
* @link https://codeigniter.com
3536
* @since Version 1.0.0
@@ -46,7 +47,7 @@
4647
* @subpackage Libraries
4748
* @category Loader
4849
* @author EllisLab Dev Team
49-
* @link https://codeigniter.com/user_guide/libraries/loader.html
50+
* @link https://codeigniter.com/userguide3/libraries/loader.html
5051
*/
5152
class CI_Loader {
5253

application/tests/_ci_phpunit_test/replacing/core/Output.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* This content is released under the MIT License (MIT)
88
*
9-
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
9+
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
1010
*
1111
* Permission is hereby granted, free of charge, to any person obtaining a copy
1212
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@
3030
* @author EllisLab Dev Team
3131
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
3232
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
33+
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
3334
* @license https://opensource.org/licenses/MIT MIT License
3435
* @link https://codeigniter.com
3536
* @since Version 1.0.0
@@ -46,7 +47,7 @@
4647
* @subpackage Libraries
4748
* @category Output
4849
* @author EllisLab Dev Team
49-
* @link https://codeigniter.com/user_guide/libraries/output.html
50+
* @link https://codeigniter.com/userguide3/libraries/output.html
5051
*/
5152
class CI_Output {
5253

@@ -55,7 +56,7 @@ class CI_Output {
5556
*
5657
* @var string
5758
*/
58-
public $final_output;
59+
public $final_output = '';
5960

6061
/**
6162
* Cache expiration time
@@ -163,7 +164,7 @@ public function __construct()
163164
&& extension_loaded('zlib')
164165
);
165166

166-
isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
167+
isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
167168

168169
// Get mime types for later
169170
$this->mimes =& get_mimes();

application/tests/_ci_phpunit_test/replacing/core/old/3.1.10-CodeIgniter.php

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)