Skip to content

Commit f6ff647

Browse files
committed
CI3 - Updates & Fixes 3.1.13
1 parent 074c3ef commit f6ff647

176 files changed

Lines changed: 1338 additions & 529 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ForgeIgniter/system/core/Benchmark.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
@@ -47,7 +48,7 @@
4748
* @subpackage Libraries
4849
* @category Libraries
4950
* @author EllisLab Dev Team
50-
* @link https://codeigniter.com/user_guide/libraries/benchmark.html
51+
* @link https://codeigniter.com/userguide3/libraries/benchmark.html
5152
*/
5253
class CI_Benchmark {
5354

ForgeIgniter/system/core/CodeIgniter.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 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.11';
59+
const CI_VERSION = '3.1.13';
5960

6061
/*
6162
* ------------------------------------------------------
@@ -434,7 +435,7 @@ function &get_instance()
434435
* ReflectionMethod::isConstructor() is the ONLY reliable check,
435436
* knowing which method will be executed as a constructor.
436437
*/
437-
elseif ( ! is_callable(array($class, $method)))
438+
else
438439
{
439440
$reflection = new ReflectionMethod($class, $method);
440441
if ( ! $reflection->isPublic() OR $reflection->isConstructor())

ForgeIgniter/system/core/Common.php

Lines changed: 6 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 CodeIgniter
4748
* @category Common Functions
4849
* @author EllisLab Dev Team
49-
* @link https://codeigniter.com/user_guide/
50+
* @link https://codeigniter.com/userguide3/
5051
*/
5152

5253
// ------------------------------------------------------------------------
@@ -565,7 +566,7 @@ function set_status_header($code = 200, $text = '')
565566
return;
566567
}
567568

568-
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
569+
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
569570
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
570571
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
571572
}
@@ -778,11 +779,9 @@ function html_escape($var, $double_encode = TRUE)
778779
*/
779780
function _stringify_attributes($attributes, $js = FALSE)
780781
{
781-
$atts = NULL;
782-
783782
if (empty($attributes))
784783
{
785-
return $atts;
784+
return NULL;
786785
}
787786

788787
if (is_string($attributes))
@@ -792,6 +791,7 @@ function _stringify_attributes($attributes, $js = FALSE)
792791

793792
$attributes = (array) $attributes;
794793

794+
$atts = '';
795795
foreach ($attributes as $key => $val)
796796
{
797797
$atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"';

ForgeIgniter/system/core/Config.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 Libraries
4849
* @author EllisLab Dev Team
49-
* @link https://codeigniter.com/user_guide/libraries/config.html
50+
* @link https://codeigniter.com/userguide3/libraries/config.html
5051
*/
5152
class CI_Config {
5253

ForgeIgniter/system/core/Controller.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
@@ -47,7 +48,7 @@
4748
* @subpackage Libraries
4849
* @category Libraries
4950
* @author EllisLab Dev Team
50-
* @link https://codeigniter.com/user_guide/general/controllers.html
51+
* @link https://codeigniter.com/userguide3/general/controllers.html
5152
*/
5253
class CI_Controller {
5354

ForgeIgniter/system/core/Exceptions.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
@@ -44,7 +45,7 @@
4445
* @subpackage Libraries
4546
* @category Exceptions
4647
* @author EllisLab Dev Team
47-
* @link https://codeigniter.com/user_guide/libraries/exceptions.html
48+
* @link https://codeigniter.com/userguide3/libraries/exceptions.html
4849
*/
4950
class CI_Exceptions {
5051

ForgeIgniter/system/core/Hooks.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 Libraries
4849
* @author EllisLab Dev Team
49-
* @link https://codeigniter.com/user_guide/general/hooks.html
50+
* @link https://codeigniter.com/userguide3/general/hooks.html
5051
*/
5152
class CI_Hooks {
5253

ForgeIgniter/system/core/Input.php

Lines changed: 48 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

@@ -357,14 +358,15 @@ public function input_stream($index = NULL, $xss_clean = NULL)
357358
* @param string $prefix Cookie name prefix
358359
* @param bool $secure Whether to only transfer cookies via SSL
359360
* @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
361+
* @param string $samesite SameSite attribute
360362
* @return void
361363
*/
362-
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
364+
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
363365
{
364366
if (is_array($name))
365367
{
366368
// always leave 'name' in last place, as the loop will break otherwise, due to $$item
367-
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item)
369+
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name', 'samesite') as $item)
368370
{
369371
if (isset($name[$item]))
370372
{
@@ -405,7 +407,47 @@ public function set_cookie($name, $value = '', $expire = '', $domain = '', $path
405407
$expire = ($expire > 0) ? time() + $expire : 0;
406408
}
407409

408-
setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly);
410+
isset($samesite) OR $samesite = config_item('cookie_samesite');
411+
if (isset($samesite))
412+
{
413+
$samesite = ucfirst(strtolower($samesite));
414+
in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax';
415+
}
416+
else
417+
{
418+
$samesite = 'Lax';
419+
}
420+
421+
if ($samesite === 'None' && ! $secure)
422+
{
423+
log_message('error', $name.' cookie sent with SameSite=None, but without Secure attribute.');
424+
}
425+
426+
if ( ! is_php('7.3'))
427+
{
428+
$maxage = $expire - time();
429+
if ($maxage < 1)
430+
{
431+
$maxage = 0;
432+
}
433+
434+
$cookie_header = 'Set-Cookie: '.$prefix.$name.'='.rawurlencode($value);
435+
$cookie_header .= ($expire === 0 ? '' : '; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)).'; Max-Age='.$maxage;
436+
$cookie_header .= '; Path='.$path.($domain !== '' ? '; Domain='.$domain : '');
437+
$cookie_header .= ($secure ? '; Secure' : '').($httponly ? '; HttpOnly' : '').'; SameSite='.$samesite;
438+
header($cookie_header);
439+
return;
440+
}
441+
442+
$setcookie_options = array(
443+
'expires' => $expire,
444+
'path' => $path,
445+
'domain' => $domain,
446+
'secure' => $secure,
447+
'httponly' => $httponly,
448+
'samesite' => $samesite,
449+
);
450+
setcookie($prefix.$name, $value, $setcookie_options);
409451
}
410452

411453
// --------------------------------------------------------------------
@@ -565,7 +607,7 @@ public function valid_ip($ip, $which = '')
565607
$which = FILTER_FLAG_IPV6;
566608
break;
567609
default:
568-
$which = NULL;
610+
$which = 0;
569611
break;
570612
}
571613

ForgeIgniter/system/core/Lang.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
@@ -44,7 +45,7 @@
4445
* @subpackage Libraries
4546
* @category Language
4647
* @author EllisLab Dev Team
47-
* @link https://codeigniter.com/user_guide/libraries/language.html
48+
* @link https://codeigniter.com/userguide3/libraries/language.html
4849
*/
4950
class CI_Lang {
5051

ForgeIgniter/system/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

0 commit comments

Comments
 (0)