diff --git a/app/Config/App.php b/app/Config/App.php index 2127162..ffe0c6c 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -237,12 +237,14 @@ | recommended CSRF protection be enabled. | | CSRFTokenName = The token name + | CSRFHeaderName = The header name | CSRFCookieName = The cookie name | CSRFExpire = The number in seconds the token should expire. | CSRFRegenerate = Regenerate token on every submission | CSRFRedirect = Redirect to previous page with error on failure */ public $CSRFTokenName = 'csrf_test_name'; + public $CSRFHeaderName = 'X-CSRF-TOKEN'; public $CSRFCookieName = 'csrf_cookie_name'; public $CSRFExpire = 7200; public $CSRFRegenerate = true; diff --git a/license.txt b/license.txt index 6808958..6dea8d0 100644 --- a/license.txt +++ b/license.txt @@ -1,6 +1,7 @@ The MIT License (MIT) Copyright (c) 2014-2019 British Columbia Institute of Technology +Copyright (c) 2019 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 diff --git a/system/API/ResponseTrait.php b/system/API/ResponseTrait.php index f887b11..e98ef0f 100644 --- a/system/API/ResponseTrait.php +++ b/system/API/ResponseTrait.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index 598ae7b..dbd1c5d 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Autoloader/FileLocator.php b/system/Autoloader/FileLocator.php index 0bacd15..7d3818b 100644 --- a/system/Autoloader/FileLocator.php +++ b/system/Autoloader/FileLocator.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -292,7 +293,7 @@ { $namespaces[] = [ 'prefix' => $prefix, - 'path' => rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, + 'path' => rtrim($path, '\\/') . DIRECTORY_SEPARATOR, ]; } } diff --git a/system/CLI/BaseCommand.php b/system/CLI/BaseCommand.php index 6013927..158413e 100644 --- a/system/CLI/BaseCommand.php +++ b/system/CLI/BaseCommand.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -195,7 +196,7 @@ * * @param string $key * - * @return bool + * @return boolean */ public function __isset(string $key): bool { diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index eb13b2a..ea17ddc 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/CLI/CommandRunner.php b/system/CLI/CommandRunner.php index 2d81124..50704ed 100644 --- a/system/CLI/CommandRunner.php +++ b/system/CLI/CommandRunner.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/CLI/Console.php b/system/CLI/Console.php index 43457b9..1affaf8 100644 --- a/system/CLI/Console.php +++ b/system/CLI/Console.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/CacheFactory.php b/system/Cache/CacheFactory.php index 1e33daf..dc85548 100644 --- a/system/Cache/CacheFactory.php +++ b/system/Cache/CacheFactory.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/CacheInterface.php b/system/Cache/CacheInterface.php index 2206db1..fc8fb90 100644 --- a/system/Cache/CacheInterface.php +++ b/system/Cache/CacheInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/Handlers/DummyHandler.php b/system/Cache/Handlers/DummyHandler.php index a123a80..a60ce01 100644 --- a/system/Cache/Handlers/DummyHandler.php +++ b/system/Cache/Handlers/DummyHandler.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index a33f893..da05026 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/Handlers/MemcachedHandler.php b/system/Cache/Handlers/MemcachedHandler.php index 9a07cff..6076da6 100644 --- a/system/Cache/Handlers/MemcachedHandler.php +++ b/system/Cache/Handlers/MemcachedHandler.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/Handlers/PredisHandler.php b/system/Cache/Handlers/PredisHandler.php index 0e1f79b..5749565 100644 --- a/system/Cache/Handlers/PredisHandler.php +++ b/system/Cache/Handlers/PredisHandler.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/Handlers/RedisHandler.php b/system/Cache/Handlers/RedisHandler.php index 54cb02d..17c8b13 100644 --- a/system/Cache/Handlers/RedisHandler.php +++ b/system/Cache/Handlers/RedisHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Cache/Handlers/WincacheHandler.php b/system/Cache/Handlers/WincacheHandler.php index f1a29d2..a49626f 100644 --- a/system/Cache/Handlers/WincacheHandler.php +++ b/system/Cache/Handlers/WincacheHandler.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index fb9a171..ae6fe77 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -38,7 +39,6 @@ namespace CodeIgniter; use Closure; -use CodeIgniter\Filters\Exceptions\FilterException; use CodeIgniter\HTTP\DownloadResponse; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\Request; @@ -50,6 +50,7 @@ use CodeIgniter\Events\Events; use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\CLIRequest; +use CodeIgniter\Router\Exceptions\RedirectException; use CodeIgniter\Router\RouteCollectionInterface; use CodeIgniter\Exceptions\PageNotFoundException; use Exception; @@ -65,7 +66,7 @@ /** * The current version of CodeIgniter Framework */ - const CI_VERSION = '4.0.0-rc.2'; + const CI_VERSION = '4.0.0-rc.3'; /** * App startup time. @@ -209,7 +210,7 @@ * @param boolean $returnResponse * * @return boolean|\CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\Response|\CodeIgniter\HTTP\ResponseInterface|mixed - * @throws \CodeIgniter\Filters\Exceptions\FilterException + * @throws \CodeIgniter\Router\Exceptions\RedirectException * @throws \Exception */ public function run(RouteCollectionInterface $routes = null, bool $returnResponse = false) @@ -244,7 +245,7 @@ { return $this->handleRequest($routes, $cacheConfig, $returnResponse); } - catch (FilterException $e) + catch (RedirectException $e) { $logger = Services::logger(); $logger->info('REDIRECTED ROUTE at ' . $e->getMessage()); @@ -252,6 +253,8 @@ // If the route is a 'redirect' route, it throws // the exception with the $to as the message $this->response->redirect($e->getMessage(), 'auto', $e->getCode()); + $this->sendResponse(); + $this->callExit(EXIT_SUCCESS); } catch (PageNotFoundException $e) diff --git a/system/Commands/Database/CreateMigration.php b/system/Commands/Database/CreateMigration.php index a674a39..db188fc 100644 --- a/system/Commands/Database/CreateMigration.php +++ b/system/Commands/Database/CreateMigration.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Database/Migrate.php b/system/Commands/Database/Migrate.php index a122dcb..6dd05b5 100644 --- a/system/Commands/Database/Migrate.php +++ b/system/Commands/Database/Migrate.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Database/MigrateRefresh.php b/system/Commands/Database/MigrateRefresh.php index 4468f16..5ea788b 100644 --- a/system/Commands/Database/MigrateRefresh.php +++ b/system/Commands/Database/MigrateRefresh.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Database/MigrateRollback.php b/system/Commands/Database/MigrateRollback.php index 515db07..37a2162 100644 --- a/system/Commands/Database/MigrateRollback.php +++ b/system/Commands/Database/MigrateRollback.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -119,12 +120,12 @@ { $batch = $params['-b'] ?? CLI::getOption('b') ?? $runner->getLastBatch() - 1; CLI::write(lang('Migrations.rollingBack') . ' ' . $batch, 'yellow'); - + if (! $runner->regress($batch)) { CLI::write(lang('Migrations.generalFault'), 'red'); } - + $messages = $runner->getCliMessages(); foreach ($messages as $message) { diff --git a/system/Commands/Database/MigrateStatus.php b/system/Commands/Database/MigrateStatus.php index f0bc498..7355533 100644 --- a/system/Commands/Database/MigrateStatus.php +++ b/system/Commands/Database/MigrateStatus.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -165,7 +166,6 @@ $date = ''; foreach ($history as $row) { - if ($runner->getObjectUid($row) !== $uid) { continue; diff --git a/system/Commands/Database/Seed.php b/system/Commands/Database/Seed.php index f19445f..32a57dd 100644 --- a/system/Commands/Database/Seed.php +++ b/system/Commands/Database/Seed.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Help.php b/system/Commands/Help.php index 0678a23..3672e6c 100644 --- a/system/Commands/Help.php +++ b/system/Commands/Help.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/ListCommands.php b/system/Commands/ListCommands.php index 75e0708..e413aec 100644 --- a/system/Commands/ListCommands.php +++ b/system/Commands/ListCommands.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Server/Serve.php b/system/Commands/Server/Serve.php index 8ca15ab..3abae11 100644 --- a/system/Commands/Server/Serve.php +++ b/system/Commands/Server/Serve.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Sessions/CreateMigration.php b/system/Commands/Sessions/CreateMigration.php index 052eb07..d030b67 100644 --- a/system/Commands/Sessions/CreateMigration.php +++ b/system/Commands/Sessions/CreateMigration.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Utilities/Namespaces.php b/system/Commands/Utilities/Namespaces.php index 36e0c77..2079a34 100644 --- a/system/Commands/Utilities/Namespaces.php +++ b/system/Commands/Utilities/Namespaces.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Commands/Utilities/Routes.php b/system/Commands/Utilities/Routes.php index ba37395..d516073 100644 --- a/system/Commands/Utilities/Routes.php +++ b/system/Commands/Utilities/Routes.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Common.php b/system/Common.php index 85f2a76..d4ecc34 100644 --- a/system/Common.php +++ b/system/Common.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -723,6 +724,25 @@ //-------------------------------------------------------------------- +if (! function_exists('csrf_header')) +{ + /** + * Returns the CSRF header name. + * Can be used in Views by adding it to the meta tag + * or used in javascript to define a header name when using APIs. + * + * @return string + */ + function csrf_header(): string + { + $config = config(App::class); + + return $config->CSRFHeaderName; + } +} + +//-------------------------------------------------------------------- + if (! function_exists('csrf_hash')) { /** @@ -759,6 +779,23 @@ //-------------------------------------------------------------------- +if (! function_exists('csrf_meta')) +{ + /** + * Generates a meta tag for use within javascript calls. + * + * @param string|null $id + * + * @return string + */ + function csrf_meta(string $id = null): string + { + return ''; + } +} + +//-------------------------------------------------------------------- + if (! function_exists('force_https')) { /** diff --git a/system/ComposerScripts.php b/system/ComposerScripts.php index a4395cb..6cf41f9 100644 --- a/system/ComposerScripts.php +++ b/system/ComposerScripts.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Config/AutoloadConfig.php b/system/Config/AutoloadConfig.php index e68aa6c..57dd92e 100644 --- a/system/Config/AutoloadConfig.php +++ b/system/Config/AutoloadConfig.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Config/BaseConfig.php b/system/Config/BaseConfig.php index 5a1c662..2d5bbf1 100644 --- a/system/Config/BaseConfig.php +++ b/system/Config/BaseConfig.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -107,7 +108,7 @@ /** * Initialization an environment-specific configuration setting * - * @param mixed &$property + * @param mixed &$property * @param string $name * @param string $prefix * @param string $shortPrefix diff --git a/system/Config/BaseService.php b/system/Config/BaseService.php index b94ef94..67f6cb6 100644 --- a/system/Config/BaseService.php +++ b/system/Config/BaseService.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Config/Config.php b/system/Config/Config.php index ae60dd3..6098037 100644 --- a/system/Config/Config.php +++ b/system/Config/Config.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Config/DotEnv.php b/system/Config/DotEnv.php index 1b4b58c..1828456 100644 --- a/system/Config/DotEnv.php +++ b/system/Config/DotEnv.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Config/ForeignCharacters.php b/system/Config/ForeignCharacters.php index 39db140..220ae10 100644 --- a/system/Config/ForeignCharacters.php +++ b/system/Config/ForeignCharacters.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Config/Routes.php b/system/Config/Routes.php index 3cc1b09..40cc49c 100644 --- a/system/Config/Routes.php +++ b/system/Config/Routes.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Config/Services.php b/system/Config/Services.php index 109410d..7eeaecb 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -209,10 +210,10 @@ $email = new \CodeIgniter\Email\Email($config); $email->setLogger(static::logger(true)); return $email; - } - - /** - * The Encryption class provides two-way encryption. + } + + /** + * The Encryption class provides two-way encryption. * * @param mixed $config * @param boolean $getShared diff --git a/system/Config/View.php b/system/Config/View.php index fcbf333..9e314a4 100644 --- a/system/Config/View.php +++ b/system/Config/View.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Controller.php b/system/Controller.php index 25a9d45..390d0de 100644 --- a/system/Controller.php +++ b/system/Controller.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index e2ab08b..2fbfd96 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -2488,6 +2489,7 @@ // Batch this baby $affected_rows = 0; $savedSQL = []; + $savedQBWhere = $this->QBWhere; for ($i = 0, $total = count($this->QBSet); $i < $total; $i += $batchSize) { $sql = $this->_updateBatch($table, array_slice($this->QBSet, $i, $batchSize), $this->db->protectIdentifiers($index) @@ -2503,7 +2505,7 @@ $affected_rows += $this->db->affectedRows(); } - $this->QBWhere = []; + $this->QBWhere = $savedQBWhere; } $this->resetWrite(); @@ -2690,7 +2692,7 @@ { $table = $this->QBFrom[0]; - $sql = $this->delete($table, '', $reset, true); + $sql = $this->delete($table, null, $reset, true); return $this->compileFinalQuery($sql); } diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 6fd5a49..038119a 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -1869,7 +1870,7 @@ * * @param string $key * - * @return bool + * @return boolean */ public function __isset(string $key): bool { diff --git a/system/Database/BasePreparedQuery.php b/system/Database/BasePreparedQuery.php index cbcfff7..d39239f 100644 --- a/system/Database/BasePreparedQuery.php +++ b/system/Database/BasePreparedQuery.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index a5c17f6..d316c07 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/BaseUtils.php b/system/Database/BaseUtils.php index a512d23..0723562 100644 --- a/system/Database/BaseUtils.php +++ b/system/Database/BaseUtils.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Config.php b/system/Database/Config.php index f275066..2c079df 100644 --- a/system/Database/Config.php +++ b/system/Database/Config.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/ConnectionInterface.php b/system/Database/ConnectionInterface.php index 302af16..26c38bd 100644 --- a/system/Database/ConnectionInterface.php +++ b/system/Database/ConnectionInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Database.php b/system/Database/Database.php index ec9c272..f27d3db 100644 --- a/system/Database/Database.php +++ b/system/Database/Database.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Exceptions/DatabaseException.php b/system/Database/Exceptions/DatabaseException.php index af25053..96738c0 100644 --- a/system/Database/Exceptions/DatabaseException.php +++ b/system/Database/Exceptions/DatabaseException.php @@ -29,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Forge.php b/system/Database/Forge.php index 2907cd6..c235fa1 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -105,6 +106,20 @@ protected $createDatabaseStr = 'CREATE DATABASE %s'; /** + * CREATE DATABASE IF statement + * + * @var string + */ + protected $createDatabaseIfStr = null; + + /** + * CHECK DATABASE EXIST statement + * + * @var string + */ + protected $checkDatabaseExistStr = null; + + /** * DROP DATABASE statement * * @var string @@ -199,13 +214,23 @@ /** * Create database * - * @param string $db_name + * @param string $dbName + * @param boolean $ifNotExists Whether to add IF NOT EXISTS condition * * @return boolean * @throws \CodeIgniter\Database\Exceptions\DatabaseException */ - public function createDatabase(string $db_name): bool + public function createDatabase(string $dbName, bool $ifNotExists = false): bool { + if ($ifNotExists && $this->createDatabaseIfStr === null) + { + if ($this->databaseExists($dbName)) + { + return true; + } + $ifNotExists = false; + } + if ($this->createDatabaseStr === false) { if ($this->db->DBDebug) @@ -215,7 +240,7 @@ return false; } - elseif (! $this->db->query(sprintf($this->createDatabaseStr, $db_name, $this->db->charset, $this->db->DBCollat)) + elseif (! $this->db->query(sprintf($ifNotExists ? $this->createDatabaseIfStr : $this->createDatabaseStr, $dbName, $this->db->charset, $this->db->DBCollat)) ) { if ($this->db->DBDebug) @@ -228,7 +253,7 @@ if (! empty($this->db->dataCache['db_names'])) { - $this->db->dataCache['db_names'][] = $db_name; + $this->db->dataCache['db_names'][] = $dbName; } return true; @@ -237,14 +262,39 @@ //-------------------------------------------------------------------- /** - * Drop database + * Determine if a database exists * - * @param string $db_name + * @param string $dbName * * @return boolean * @throws \CodeIgniter\Database\Exceptions\DatabaseException */ - public function dropDatabase(string $db_name): bool + private function databaseExists(string $dbName): bool + { + if ($this->checkDatabaseExistStr === null) + { + if ($this->db->DBDebug) + { + throw new DatabaseException('This feature is not available for the database you are using.'); + } + + return false; + } + + return $this->db->query($this->checkDatabaseExistStr, $dbName)->getRow() !== null; + } + + //-------------------------------------------------------------------- + + /** + * Drop database + * + * @param string $dbName + * + * @return boolean + * @throws \CodeIgniter\Database\Exceptions\DatabaseException + */ + public function dropDatabase(string $dbName): bool { if ($this->dropDatabaseStr === false) { @@ -255,7 +305,7 @@ return false; } - elseif (! $this->db->query(sprintf($this->dropDatabaseStr, $db_name))) + elseif (! $this->db->query(sprintf($this->dropDatabaseStr, $dbName))) { if ($this->db->DBDebug) { @@ -267,7 +317,7 @@ if (! empty($this->db->dataCache['db_names'])) { - $key = array_search(strtolower($db_name), array_map('strtolower', $this->db->dataCache['db_names']), true); + $key = array_search(strtolower($dbName), array_map('strtolower', $this->db->dataCache['db_names']), true); if ($key !== false) { unset($this->db->dataCache['db_names'][$key]); diff --git a/system/Database/Migration.php b/system/Database/Migration.php index bfa31a9..7d53c23 100644 --- a/system/Database/Migration.php +++ b/system/Database/Migration.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -74,7 +75,7 @@ */ public function __construct(Forge $forge = null) { - $this->forge = ! is_null($forge) ? $forge : \Config\Database::forge($this->DBGroup); + $this->forge = ! is_null($forge) ? $forge : \Config\Database::forge($this->DBGroup ?? config('Database')->defaultGroup); $this->db = $this->forge->getConnection(); } @@ -86,7 +87,7 @@ * * @return string */ - public function getDBGroup(): string + public function getDBGroup(): ?string { return $this->DBGroup; } diff --git a/system/Database/MigrationRunner.php b/system/Database/MigrationRunner.php index 25fe423..4407363 100644 --- a/system/Database/MigrationRunner.php +++ b/system/Database/MigrationRunner.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -128,6 +129,20 @@ */ protected $path; + /** + * The database Group filter. + * + * @var string + */ + protected $groupFilter; + + /** + * Used to skip current migration. + * + * @var boolean + */ + protected $groupSkip = false; + //-------------------------------------------------------------------- /** @@ -180,6 +195,7 @@ // Set database group if not null if (! is_null($group)) { + $this->groupFilter = $group; $this->setGroup($group); } @@ -206,6 +222,12 @@ { if ($this->migrate('up', $migration)) { + if ($this->groupSkip === true) + { + $this->groupSkip = false; + continue; + } + $this->addHistory($migration, $batch); } // If a migration failed then try to back out what was done @@ -370,6 +392,7 @@ // Set database group if not null if (! is_null($group)) { + $this->groupFilter = $group; $this->setGroup($group); } @@ -406,11 +429,13 @@ // Start a new batch $batch = $this->getLastBatch() + 1; - if ($this->migrate('up', $migration)) + if ($this->migrate('up', $migration) && $this->groupSkip === false) { $this->addHistory($migration, $batch); return true; } + + $this->groupSkip = false; } // down @@ -991,8 +1016,19 @@ throw new \RuntimeException($message); } - // Forcing migration to selected database group - $instance = new $class(\Config\Database::forge($this->group)); + // Initialize migration + $instance = new $class(); + // Determine DBGroup to use + $group = $instance->getDBGroup() ?? config('Database')->defaultGroup; + + // Skip migration if group filtering was set + if ($direction === 'up' && ! is_null($this->groupFilter) && $this->groupFilter !== $group) + { + $this->groupSkip = true; + return true; + } + + $this->setGroup($group); if (! is_callable([$instance, $direction])) { diff --git a/system/Database/MySQLi/Builder.php b/system/Database/MySQLi/Builder.php index 6bfe554..908f571 100644 --- a/system/Database/MySQLi/Builder.php +++ b/system/Database/MySQLi/Builder.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -53,4 +54,24 @@ */ protected $escapeChar = '`'; + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * Note: This is only used (and overridden) by MySQL. + * + * @return string + */ + protected function _fromTables(): string + { + if (! empty($this->QBJoin) && count($this->QBFrom) > 1) + { + return '(' . implode(', ', $this->QBFrom) . ')'; + } + + return implode(', ', $this->QBFrom); + } + } diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index 059c860..70c3f9c 100644 --- a/system/Database/MySQLi/Connection.php +++ b/system/Database/MySQLi/Connection.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -395,7 +396,7 @@ * additional "ESCAPE x" parameter for specifying the escape character * in "LIKE" strings, and this handles those directly with a backslash. * - * @param string|string[] $str Input string + * @param string|string[] $str Input string * @return string|string[] */ public function escapeLikeStringDirect($str) @@ -428,7 +429,7 @@ } //-------------------------------------------------------------------- - + /** * Generates the SQL for listing tables in a platform-dependent manner. * Uses escapeLikeStringDirect(). diff --git a/system/Database/MySQLi/Forge.php b/system/Database/MySQLi/Forge.php index 52168af..c17f1ac 100644 --- a/system/Database/MySQLi/Forge.php +++ b/system/Database/MySQLi/Forge.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -52,6 +53,13 @@ protected $createDatabaseStr = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s'; /** + * CREATE DATABASE IF statement + * + * @var string + */ + protected $createDatabaseIfStr = 'CREATE DATABASE IF NOT EXISTS %s CHARACTER SET %s COLLATE %s'; + + /** * DROP CONSTRAINT statement * * @var string diff --git a/system/Database/MySQLi/PreparedQuery.php b/system/Database/MySQLi/PreparedQuery.php index a510a37..ef02018 100644 --- a/system/Database/MySQLi/PreparedQuery.php +++ b/system/Database/MySQLi/PreparedQuery.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/MySQLi/Result.php b/system/Database/MySQLi/Result.php index 630a4f7..65cb23f 100644 --- a/system/Database/MySQLi/Result.php +++ b/system/Database/MySQLi/Result.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/MySQLi/Utils.php b/system/Database/MySQLi/Utils.php index 5ebe7fb..799a03d 100644 --- a/system/Database/MySQLi/Utils.php +++ b/system/Database/MySQLi/Utils.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Postgre/Builder.php b/system/Database/Postgre/Builder.php index e86f37c..a7424b0 100644 --- a/system/Database/Postgre/Builder.php +++ b/system/Database/Postgre/Builder.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index be9556a..4dac1ec 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Postgre/Forge.php b/system/Database/Postgre/Forge.php index 1dcbaf8..d0ad4f1 100644 --- a/system/Database/Postgre/Forge.php +++ b/system/Database/Postgre/Forge.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -45,6 +46,13 @@ { /** + * CHECK DATABASE EXIST statement + * + * @var string + */ + protected $checkDatabaseExistStr = 'SELECT 1 FROM pg_database WHERE datname = ?'; + + /** * DROP CONSTRAINT statement * * @var string @@ -74,7 +82,7 @@ * @var string */ protected $_null = 'NULL'; - + //-------------------------------------------------------------------- /** diff --git a/system/Database/Postgre/PreparedQuery.php b/system/Database/Postgre/PreparedQuery.php index 9cf88bd..d1598cc 100644 --- a/system/Database/Postgre/PreparedQuery.php +++ b/system/Database/Postgre/PreparedQuery.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Postgre/Result.php b/system/Database/Postgre/Result.php index 106a7e1..a33f9f0 100644 --- a/system/Database/Postgre/Result.php +++ b/system/Database/Postgre/Result.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Postgre/Utils.php b/system/Database/Postgre/Utils.php index aa95536..85965a0 100644 --- a/system/Database/Postgre/Utils.php +++ b/system/Database/Postgre/Utils.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/PreparedQueryInterface.php b/system/Database/PreparedQueryInterface.php index d29e250..1ddbad0 100644 --- a/system/Database/PreparedQueryInterface.php +++ b/system/Database/PreparedQueryInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Query.php b/system/Database/Query.php index 06d1359..e1af64f 100644 --- a/system/Database/Query.php +++ b/system/Database/Query.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/QueryInterface.php b/system/Database/QueryInterface.php index f7381b9..423ac9f 100644 --- a/system/Database/QueryInterface.php +++ b/system/Database/QueryInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/ResultInterface.php b/system/Database/ResultInterface.php index 6ebfe2c..d8413b2 100644 --- a/system/Database/ResultInterface.php +++ b/system/Database/ResultInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/SQLite3/Builder.php b/system/Database/SQLite3/Builder.php index ba09b58..911b9fe 100644 --- a/system/Database/SQLite3/Builder.php +++ b/system/Database/SQLite3/Builder.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/SQLite3/Connection.php b/system/Database/SQLite3/Connection.php index f03b6bb..0ce1dac 100644 --- a/system/Database/SQLite3/Connection.php +++ b/system/Database/SQLite3/Connection.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/SQLite3/Forge.php b/system/Database/SQLite3/Forge.php index e19d4b6..877c78e 100644 --- a/system/Database/SQLite3/Forge.php +++ b/system/Database/SQLite3/Forge.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -84,11 +85,12 @@ /** * Create database * - * @param string $db_name + * @param string $dbName + * @param boolean $ifNotExists Whether to add IF NOT EXISTS condition * * @return boolean */ - public function createDatabase(string $db_name): bool + public function createDatabase(string $dbName, bool $ifNotExists = false): bool { // In SQLite, a database is created when you connect to the database. // We'll return TRUE so that an error isn't generated. @@ -100,15 +102,15 @@ /** * Drop database * - * @param string $db_name + * @param string $dbName * * @return boolean * @throws \CodeIgniter\Database\Exceptions\DatabaseException */ - public function dropDatabase(string $db_name): bool + public function dropDatabase(string $dbName): bool { // In SQLite, a database is dropped when we delete a file - if (! is_file($db_name)) + if (! is_file($dbName)) { if ($this->db->DBDebug) { @@ -120,7 +122,7 @@ // We need to close the pseudo-connection first $this->db->close(); - if (! @unlink($db_name)) + if (! @unlink($dbName)) { if ($this->db->DBDebug) { @@ -132,7 +134,7 @@ if (! empty($this->db->dataCache['db_names'])) { - $key = array_search(strtolower($db_name), array_map('strtolower', $this->db->dataCache['db_names']), true); + $key = array_search(strtolower($dbName), array_map('strtolower', $this->db->dataCache['db_names']), true); if ($key !== false) { unset($this->db->dataCache['db_names'][$key]); diff --git a/system/Database/SQLite3/PreparedQuery.php b/system/Database/SQLite3/PreparedQuery.php index 8ffb502..8f73385 100644 --- a/system/Database/SQLite3/PreparedQuery.php +++ b/system/Database/SQLite3/PreparedQuery.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/SQLite3/Result.php b/system/Database/SQLite3/Result.php index 3d56715..3d8c53a 100644 --- a/system/Database/SQLite3/Result.php +++ b/system/Database/SQLite3/Result.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/SQLite3/Table.php b/system/Database/SQLite3/Table.php index 14973d5..a15f9a0 100644 --- a/system/Database/SQLite3/Table.php +++ b/system/Database/SQLite3/Table.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/SQLite3/Utils.php b/system/Database/SQLite3/Utils.php index 5c4263a..f7cb337 100644 --- a/system/Database/SQLite3/Utils.php +++ b/system/Database/SQLite3/Utils.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Database/Seeder.php b/system/Database/Seeder.php index 18c8304..023cb4e 100644 --- a/system/Database/Seeder.php +++ b/system/Database/Seeder.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 6e6b33a..a3ed7bf 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -461,7 +462,7 @@ $source = array_splice($source, $start, $lines, true); // Used to format the line number in the source - $format = '% ' . strlen(sprintf('%sd', $start + $lines)); + $format = '% ' . strlen(sprintf('%s', $start + $lines)) . 'd'; $out = ''; // Because the highlighting may have an uneven number diff --git a/system/Debug/Iterator.php b/system/Debug/Iterator.php index abad5f4..8f97807 100644 --- a/system/Debug/Iterator.php +++ b/system/Debug/Iterator.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Timer.php b/system/Debug/Timer.php index ab5fc2d..1d6438e 100644 --- a/system/Debug/Timer.php +++ b/system/Debug/Timer.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index 6994684..4e218bc 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -57,6 +58,7 @@ */ class Toolbar { + /** * Toolbar configuration settings. * @@ -87,7 +89,7 @@ if (! class_exists($collector)) { log_message('critical', 'Toolbar collector does not exists(' . $collector . ').' . - 'please check $collectors in the Config\Toolbar.php file.'); + 'please check $collectors in the Config\Toolbar.php file.'); continue; } @@ -117,7 +119,7 @@ $data['totalTime'] = $totalTime * 1000; $data['totalMemory'] = number_format((memory_get_peak_usage()) / 1024 / 1024, 3); $data['segmentDuration'] = $this->roundTo($data['totalTime'] / 7, 5); - $data['segmentCount'] = (int)ceil($data['totalTime'] / $data['segmentDuration']); + $data['segmentCount'] = (int) ceil($data['totalTime'] / $data['segmentDuration']); $data['CI_VERSION'] = \CodeIgniter\CodeIgniter::CI_VERSION; $data['collectors'] = []; @@ -200,14 +202,13 @@ if ($response->CSP !== null) { - $response->CSP->addImageSrc( 'data:' ); + $response->CSP->addImageSrc('data:'); } return json_encode($data); } //-------------------------------------------------------------------- - //-------------------------------------------------------------------- /** @@ -221,7 +222,7 @@ * * @return string */ - protected function renderTimeline(array $collectors, $startTime, int $segmentCount, int $segmentDuration, array &$styles): string + protected function renderTimeline(array $collectors, float $startTime, int $segmentCount, int $segmentDuration, array &$styles): string { $displayTime = $segmentCount * $segmentDuration; $rows = $this->collectTimelineData($collectors); @@ -236,15 +237,15 @@ $output .= "" . number_format($row['duration'] * 1000, 2) . ' ms'; $output .= ""; - $offset = ((($row['start'] - $startTime) * 1000) / $displayTime) * 100; - $length = (($row['duration'] * 1000) / $displayTime) * 100; + $offset = ((((float) $row['start'] - $startTime) * 1000) / $displayTime) * 100; + $length = (((float) $row['duration'] * 1000) / $displayTime) * 100; $styles['debug-bar-timeline-' . $styleCount] = "left: {$offset}%; width: {$length}%;"; $output .= ""; $output .= ''; $output .= ''; - $styleCount++; + $styleCount ++; } return $output; @@ -349,10 +350,10 @@ $toolbar = Services::toolbar(config(Toolbar::class)); $stats = $app->getPerformanceStats(); $data = $toolbar->run( - $stats['startTime'], - $stats['totalTime'], - $request, - $response + $stats['startTime'], + $stats['totalTime'], + $request, + $response ); helper('filesystem'); @@ -375,24 +376,24 @@ if ($request->isAJAX() || strpos($format, 'html') === false) { $response->setHeader('Debugbar-Time', $time) - ->setHeader('Debugbar-Link', site_url("?debugbar_time={$time}")) - ->getBody(); + ->setHeader('Debugbar-Link', site_url("?debugbar_time={$time}")) + ->getBody(); return; } $script = PHP_EOL - . '' - . '' - . '' - . PHP_EOL; + . '' + . '' + . '' + . PHP_EOL; if (strpos($response->getBody(), '') !== false) { $response->setBody( - str_replace('', $script . '', $response->getBody()) + str_replace('', $script . '', $response->getBody()) ); return; @@ -476,8 +477,8 @@ { $history = new History(); $history->setFiles( - Services::request()->getGet('debugbar_time'), - $this->config->maxHistory + Services::request()->getGet('debugbar_time'), + $this->config->maxHistory ); $data['collectors'][] = $history->getAsArray(); @@ -507,4 +508,5 @@ return $output; } + } diff --git a/system/Debug/Toolbar/Collectors/BaseCollector.php b/system/Debug/Toolbar/Collectors/BaseCollector.php index 16a948d..6fe76f9 100644 --- a/system/Debug/Toolbar/Collectors/BaseCollector.php +++ b/system/Debug/Toolbar/Collectors/BaseCollector.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/Config.php b/system/Debug/Toolbar/Collectors/Config.php index 25ef37f..f6839b4 100644 --- a/system/Debug/Toolbar/Collectors/Config.php +++ b/system/Debug/Toolbar/Collectors/Config.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/Database.php b/system/Debug/Toolbar/Collectors/Database.php index c75a985..5b03d05 100644 --- a/system/Debug/Toolbar/Collectors/Database.php +++ b/system/Debug/Toolbar/Collectors/Database.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/Events.php b/system/Debug/Toolbar/Collectors/Events.php index a20faca..c574507 100644 --- a/system/Debug/Toolbar/Collectors/Events.php +++ b/system/Debug/Toolbar/Collectors/Events.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/Files.php b/system/Debug/Toolbar/Collectors/Files.php index 35403a1..78c8b51 100644 --- a/system/Debug/Toolbar/Collectors/Files.php +++ b/system/Debug/Toolbar/Collectors/Files.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/History.php b/system/Debug/Toolbar/Collectors/History.php index d0f2806..90152f2 100644 --- a/system/Debug/Toolbar/Collectors/History.php +++ b/system/Debug/Toolbar/Collectors/History.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/Logs.php b/system/Debug/Toolbar/Collectors/Logs.php index 7077765..b310b60 100644 --- a/system/Debug/Toolbar/Collectors/Logs.php +++ b/system/Debug/Toolbar/Collectors/Logs.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/Routes.php b/system/Debug/Toolbar/Collectors/Routes.php index aecbc32..4891a15 100644 --- a/system/Debug/Toolbar/Collectors/Routes.php +++ b/system/Debug/Toolbar/Collectors/Routes.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -88,7 +89,25 @@ $route = $router->getMatchedRoute(); // Get our parameters - $method = is_callable($router->controllerName()) ? new \ReflectionFunction($router->controllerName()) : new \ReflectionMethod($router->controllerName(), $router->methodName()); + // Closure routes + if (is_callable($router->controllerName())) + { + $method = new \ReflectionFunction($router->controllerName()); + } + else + { + try + { + $method = new \ReflectionMethod($router->controllerName(), $router->methodName()); + } + catch (\ReflectionException $e) + { + // If we're here, the method doesn't exist + // and is likely calculated in _remap. + $method = new \ReflectionMethod($router->controllerName(), '_remap'); + } + } + $rawParams = $method->getParameters(); $params = []; diff --git a/system/Debug/Toolbar/Collectors/Timers.php b/system/Debug/Toolbar/Collectors/Timers.php index adf5409..ea5f5e3 100644 --- a/system/Debug/Toolbar/Collectors/Timers.php +++ b/system/Debug/Toolbar/Collectors/Timers.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Debug/Toolbar/Collectors/Views.php b/system/Debug/Toolbar/Collectors/Views.php index 25c909f..1f92507 100644 --- a/system/Debug/Toolbar/Collectors/Views.php +++ b/system/Debug/Toolbar/Collectors/Views.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Email/Email.php b/system/Email/Email.php index 0c72b95..42d4b22 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2019, British Columbia Institute of Technology + * Copyright (c) 2019 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 diff --git a/system/Encryption/EncrypterInterface.php b/system/Encryption/EncrypterInterface.php index a9c4542..3a3ff7c 100644 --- a/system/Encryption/EncrypterInterface.php +++ b/system/Encryption/EncrypterInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2017 British Columbia Institute of Technology + * Copyright (c) 2019 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 diff --git a/system/Encryption/Encryption.php b/system/Encryption/Encryption.php index 4adfd95..16f15f8 100644 --- a/system/Encryption/Encryption.php +++ b/system/Encryption/Encryption.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2017 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -199,7 +200,7 @@ * __isset() magic, providing checking for some of our protected properties * * @param string $key Property name - * @return bool + * @return boolean */ public function __isset($key): bool { diff --git a/system/Encryption/Handlers/BaseHandler.php b/system/Encryption/Handlers/BaseHandler.php index 3a20644..1efd401 100644 --- a/system/Encryption/Handlers/BaseHandler.php +++ b/system/Encryption/Handlers/BaseHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2017 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -114,7 +115,7 @@ * __isset() magic, providing checking for some of our properties * * @param string $key Property name - * @return bool + * @return boolean */ public function __isset($key): bool { diff --git a/system/Encryption/Handlers/OpenSSLHandler.php b/system/Encryption/Handlers/OpenSSLHandler.php index e1df4d7..ddaa8cb 100644 --- a/system/Encryption/Handlers/OpenSSLHandler.php +++ b/system/Encryption/Handlers/OpenSSLHandler.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2017 British Columbia Institute of Technology + * Copyright (c) 2019 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 diff --git a/system/Entity.php b/system/Entity.php index d88bd1d..63a984e 100644 --- a/system/Entity.php +++ b/system/Entity.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -182,7 +183,8 @@ { foreach ($this->datamap as $from => $to) { - if (array_key_exists($to, $return)) { + if (array_key_exists($to, $return)) + { $return[$from] = $this->__get($to); } } diff --git a/system/Events/Events.php b/system/Events/Events.php index 5fab269..ae1f69a 100644 --- a/system/Events/Events.php +++ b/system/Events/Events.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Files/File.php b/system/Files/File.php index 57d650c..69a5a4b 100644 --- a/system/Files/File.php +++ b/system/Files/File.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Filters/CSRF.php b/system/Filters/CSRF.php index 7f7e9f3..193911f 100644 --- a/system/Filters/CSRF.php +++ b/system/Filters/CSRF.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Filters/DebugToolbar.php b/system/Filters/DebugToolbar.php index cccf374..78e8653 100644 --- a/system/Filters/DebugToolbar.php +++ b/system/Filters/DebugToolbar.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Filters/FilterInterface.php b/system/Filters/FilterInterface.php index 6123d21..97bf806 100644 --- a/system/Filters/FilterInterface.php +++ b/system/Filters/FilterInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index fb2e918..b9832e9 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Filters/Honeypot.php b/system/Filters/Honeypot.php index c4b9b86..4faffd6 100644 --- a/system/Filters/Honeypot.php +++ b/system/Filters/Honeypot.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Format/FormatterInterface.php b/system/Format/FormatterInterface.php index 9376228..c50be49 100644 --- a/system/Format/FormatterInterface.php +++ b/system/Format/FormatterInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Format/JSONFormatter.php b/system/Format/JSONFormatter.php index e05137a..6beb88d 100644 --- a/system/Format/JSONFormatter.php +++ b/system/Format/JSONFormatter.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Format/XMLFormatter.php b/system/Format/XMLFormatter.php index cb94aed..d45942c 100644 --- a/system/Format/XMLFormatter.php +++ b/system/Format/XMLFormatter.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/CLIRequest.php b/system/HTTP/CLIRequest.php index 8c80811..28b6616 100644 --- a/system/HTTP/CLIRequest.php +++ b/system/HTTP/CLIRequest.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index abeb300..ddf1cbb 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -487,6 +488,13 @@ */ protected function applyRequestHeaders(array $curl_options = []): array { + if (empty($this->headers)) + { + $this->populateHeaders(); + // Otherwise, it will corrupt the request + $this->removeHeader('Host'); + } + $headers = $this->getHeaders(); if (empty($headers)) @@ -675,7 +683,7 @@ if ($config['debug']) { $curl_options[CURLOPT_VERBOSE] = 1; - $curl_options[CURLOPT_STDERR] = is_string($config['debug']) ? fopen($config['debug'], 'a+') : fopen('php://output', 'w+'); + $curl_options[CURLOPT_STDERR] = is_string($config['debug']) ? fopen($config['debug'], 'a+') : fopen('php://stderr', 'w'); } // Decode Content diff --git a/system/HTTP/ContentSecurityPolicy.php b/system/HTTP/ContentSecurityPolicy.php index d88cd40..ebac8cb 100644 --- a/system/HTTP/ContentSecurityPolicy.php +++ b/system/HTTP/ContentSecurityPolicy.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/DownloadResponse.php b/system/HTTP/DownloadResponse.php index e4960a7..f394543 100644 --- a/system/HTTP/DownloadResponse.php +++ b/system/HTTP/DownloadResponse.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/Exceptions/HTTPException.php b/system/HTTP/Exceptions/HTTPException.php index 22448b6..dc9f48e 100644 --- a/system/HTTP/Exceptions/HTTPException.php +++ b/system/HTTP/Exceptions/HTTPException.php @@ -29,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index 4481f8e..95f51cb 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/Files/UploadedFile.php b/system/HTTP/Files/UploadedFile.php index 72ef676..d7ff326 100644 --- a/system/HTTP/Files/UploadedFile.php +++ b/system/HTTP/Files/UploadedFile.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -400,12 +401,12 @@ */ public function store(string $folderName = null, string $fileName = null): string { - $folderName = $folderName ?? date('Ymd'); + $folderName = rtrim($folderName ?? date('Ymd'), '/') . '/' ; $fileName = $fileName ?? $this->getRandomName(); // Move the uploaded file to a new location. return ($this->move(WRITEPATH . 'uploads/' . $folderName, $fileName)) ? - $folderName . DIRECTORY_SEPARATOR . $this->name : null; + $folderName . $this->name : null; } //-------------------------------------------------------------------- diff --git a/system/HTTP/Files/UploadedFileInterface.php b/system/HTTP/Files/UploadedFileInterface.php index d98696b..7aa5aaa 100644 --- a/system/HTTP/Files/UploadedFileInterface.php +++ b/system/HTTP/Files/UploadedFileInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/Header.php b/system/HTTP/Header.php index 2f44c04..ff92ffa 100644 --- a/system/HTTP/Header.php +++ b/system/HTTP/Header.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index e064e6f..51fc61f 100755 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/Message.php b/system/HTTP/Message.php index a5bf191..ba7c5a2 100644 --- a/system/HTTP/Message.php +++ b/system/HTTP/Message.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -267,14 +268,14 @@ public function setHeader(string $name, $value) { $origName = $this->getHeaderName($name); - + if (isset($this->headers[$origName]) && is_array($this->headers[$origName])) { $this->appendHeader($origName, $value); } else { - $this->headers[$origName] = new Header($origName, $value); + $this->headers[$origName] = new Header($origName, $value); $this->headerMap[strtolower($origName)] = $origName; } diff --git a/system/HTTP/Negotiate.php b/system/HTTP/Negotiate.php index dbad9df..4033d7d 100644 --- a/system/HTTP/Negotiate.php +++ b/system/HTTP/Negotiate.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/RedirectResponse.php b/system/HTTP/RedirectResponse.php index ad9f70b..abcf262 100644 --- a/system/HTTP/RedirectResponse.php +++ b/system/HTTP/RedirectResponse.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/Request.php b/system/HTTP/Request.php index 1ddb686..ffb90c0 100644 --- a/system/HTTP/Request.php +++ b/system/HTTP/Request.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/RequestInterface.php b/system/HTTP/RequestInterface.php index e28fa67..b88bdbe 100644 --- a/system/HTTP/RequestInterface.php +++ b/system/HTTP/RequestInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/Response.php b/system/HTTP/Response.php index 23855c2..80b9366 100644 --- a/system/HTTP/Response.php +++ b/system/HTTP/Response.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/ResponseInterface.php b/system/HTTP/ResponseInterface.php index 28370a1..2ea6c6e 100644 --- a/system/HTTP/ResponseInterface.php +++ b/system/HTTP/ResponseInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index 72f7722..33f0081 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/HTTP/UserAgent.php b/system/HTTP/UserAgent.php index 8674a22..8dc292e 100644 --- a/system/HTTP/UserAgent.php +++ b/system/HTTP/UserAgent.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php index b43ab4b..518c8ae 100644 --- a/system/Helpers/array_helper.php +++ b/system/Helpers/array_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php index 5e80918..a704671 100755 --- a/system/Helpers/cookie_helper.php +++ b/system/Helpers/cookie_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Helpers/date_helper.php b/system/Helpers/date_helper.php index 91573cb..5ecf9f7 100644 --- a/system/Helpers/date_helper.php +++ b/system/Helpers/date_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Helpers/filesystem_helper.php b/system/Helpers/filesystem_helper.php index 3d34c79..62e7f12 100644 --- a/system/Helpers/filesystem_helper.php +++ b/system/Helpers/filesystem_helper.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * @package CodeIgniter * @author CodeIgniter Dev Team * @copyright 2008-2014 EllisLab, Inc. (https://ellislab.com/) - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index ccc2b24..a260980 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Helpers/html_helper.php b/system/Helpers/html_helper.php index 7f11aac..72891a6 100755 --- a/system/Helpers/html_helper.php +++ b/system/Helpers/html_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Helpers/inflector_helper.php b/system/Helpers/inflector_helper.php index d3a8ded..9389af0 100755 --- a/system/Helpers/inflector_helper.php +++ b/system/Helpers/inflector_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -165,6 +166,29 @@ //-------------------------------------------------------------------- +if (! function_exists('counted')) +{ + /** + * Counted + * + * Takes a number and a word to return the plural or not + * E.g. 0 cats, 1 cat, 2 cats, ... + * + * @param integer $count Number of items + * @param string $string Input string + * @return string + */ + function counted(int $count, string $string): string + { + $result = "{$count} "; + $result .= $count === 1 ? singular($string) : plural($string); + + return $result; + } +} + +//-------------------------------------------------------------------- + if (! function_exists('camelize')) { /** diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 7723c96..2bcc3ed 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * @package CodeIgniter * @author CodeIgniter Dev Team * @copyright 2008-2014 EllisLab, Inc. (https://ellislab.com/) - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/Helpers/security_helper.php b/system/Helpers/security_helper.php index 1ef170e..26ef455 100644 --- a/system/Helpers/security_helper.php +++ b/system/Helpers/security_helper.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Helpers/text_helper.php b/system/Helpers/text_helper.php index 6a79350..2bd189c 100755 --- a/system/Helpers/text_helper.php +++ b/system/Helpers/text_helper.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * @package CodeIgniter * @author CodeIgniter Dev Team * @copyright 2008-2014 EllisLab, Inc. (https://ellislab.com/) - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index 5b6dd16..9445f18 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -582,7 +583,7 @@ if ($lowercase === true) { - $str = strtolower($str); + $str = mb_strtolower($str); } return trim(trim($str, $separator)); diff --git a/system/Helpers/xml_helper.php b/system/Helpers/xml_helper.php index 17be4e9..8209b03 100644 --- a/system/Helpers/xml_helper.php +++ b/system/Helpers/xml_helper.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/Honeypot/Honeypot.php b/system/Honeypot/Honeypot.php index ac94f0c..68d5a62 100644 --- a/system/Honeypot/Honeypot.php +++ b/system/Honeypot/Honeypot.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/I18n/Time.php b/system/I18n/Time.php index d56f0cf..b26e7fe 100644 --- a/system/I18n/Time.php +++ b/system/I18n/Time.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -1349,7 +1350,7 @@ * * @param $name * - * @return bool + * @return boolean */ public function __isset($name): bool { diff --git a/system/I18n/TimeDifference.php b/system/I18n/TimeDifference.php index 9af8269..637b448 100644 --- a/system/I18n/TimeDifference.php +++ b/system/I18n/TimeDifference.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -351,7 +352,7 @@ * * @param $name * - * @return bool + * @return boolean */ public function __isset($name) { diff --git a/system/Images/Handlers/BaseHandler.php b/system/Images/Handlers/BaseHandler.php index 6c5d198..1c06265 100644 --- a/system/Images/Handlers/BaseHandler.php +++ b/system/Images/Handlers/BaseHandler.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php index 02c9178..41cb7b4 100644 --- a/system/Images/Handlers/GDHandler.php +++ b/system/Images/Handlers/GDHandler.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Images/Handlers/ImageMagickHandler.php b/system/Images/Handlers/ImageMagickHandler.php index 3adf8e7..97f4a1a 100644 --- a/system/Images/Handlers/ImageMagickHandler.php +++ b/system/Images/Handlers/ImageMagickHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -304,7 +305,7 @@ $result = $this->process($action, $quality); unlink($this->resource); - + return true; } diff --git a/system/Images/Image.php b/system/Images/Image.php index 3e7e608..1ffe87b 100644 --- a/system/Images/Image.php +++ b/system/Images/Image.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Images/ImageHandlerInterface.php b/system/Images/ImageHandlerInterface.php index e13087c..d0631e8 100644 --- a/system/Images/ImageHandlerInterface.php +++ b/system/Images/ImageHandlerInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/Language.php b/system/Language/Language.php index 19494f7..1abe60d 100644 --- a/system/Language/Language.php +++ b/system/Language/Language.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/CLI.php b/system/Language/en/CLI.php index 5bb5833..06eeee3 100644 --- a/system/Language/en/CLI.php +++ b/system/Language/en/CLI.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Cache.php b/system/Language/en/Cache.php index d2489f5..a89cd87 100644 --- a/system/Language/en/Cache.php +++ b/system/Language/en/Cache.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Cast.php b/system/Language/en/Cast.php index f5050a8..9d39682 100644 --- a/system/Language/en/Cast.php +++ b/system/Language/en/Cast.php @@ -4,7 +4,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Core.php b/system/Language/en/Core.php index 2071803..a78fc42 100644 --- a/system/Language/en/Core.php +++ b/system/Language/en/Core.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Database.php b/system/Language/en/Database.php index 22d719c..08748e3 100644 --- a/system/Language/en/Database.php +++ b/system/Language/en/Database.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Email.php b/system/Language/en/Email.php index c4bd1ac..b99117b 100644 --- a/system/Language/en/Email.php +++ b/system/Language/en/Email.php @@ -4,7 +4,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 3.0.0 diff --git a/system/Language/en/Encryption.php b/system/Language/en/Encryption.php index 707c3ba..ddf1543 100644 --- a/system/Language/en/Encryption.php +++ b/system/Language/en/Encryption.php @@ -4,7 +4,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 3.0.0 @@ -16,7 +16,7 @@ return [ 'noDriverRequested' => 'No driver requested; Miss Daisy will be so upset!', 'noHandlerAvailable' => 'Unable to find an available {0} encryption handler.', - 'unKnownHandler' => "'{0}' cannot be configured.", + 'unKnownHandler' => '"{0}" cannot be configured.', 'starterKeyNeeded' => 'Encrypter needs a starter key.', 'authenticationFailed' => 'Decrypting: authentication failed.', 'encryptionFailed' => 'Encryption failed.', diff --git a/system/Language/en/Entity.php b/system/Language/en/Entity.php index 71f9e76..52a014a 100644 --- a/system/Language/en/Entity.php +++ b/system/Language/en/Entity.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @filesource diff --git a/system/Language/en/Files.php b/system/Language/en/Files.php index 37d551b..e952144 100644 --- a/system/Language/en/Files.php +++ b/system/Language/en/Files.php @@ -4,7 +4,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Filters.php b/system/Language/en/Filters.php index 9a525db..bc1a882 100644 --- a/system/Language/en/Filters.php +++ b/system/Language/en/Filters.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Format.php b/system/Language/en/Format.php index 1f7c39b..0753dd2 100644 --- a/system/Language/en/Format.php +++ b/system/Language/en/Format.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/HTTP.php b/system/Language/en/HTTP.php index a43d814..9f94419 100644 --- a/system/Language/en/HTTP.php +++ b/system/Language/en/HTTP.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Images.php b/system/Language/en/Images.php index ec413eb..740b9e8 100644 --- a/system/Language/en/Images.php +++ b/system/Language/en/Images.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Language.php b/system/Language/en/Language.php index 17866d3..efd395b 100644 --- a/system/Language/en/Language.php +++ b/system/Language/en/Language.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Log.php b/system/Language/en/Log.php index f2c2d78..8afd8f6 100644 --- a/system/Language/en/Log.php +++ b/system/Language/en/Log.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Migrations.php b/system/Language/en/Migrations.php index 8e3ca49..efcc94c 100644 --- a/system/Language/en/Migrations.php +++ b/system/Language/en/Migrations.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Number.php b/system/Language/en/Number.php index c399962..ec8ea47 100644 --- a/system/Language/en/Number.php +++ b/system/Language/en/Number.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Pager.php b/system/Language/en/Pager.php index e18fb6c..3d4ad91 100644 --- a/system/Language/en/Pager.php +++ b/system/Language/en/Pager.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/RESTful.php b/system/Language/en/RESTful.php index 623d89f..c5d2389 100644 --- a/system/Language/en/RESTful.php +++ b/system/Language/en/RESTful.php @@ -4,7 +4,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 3.0.0 @@ -14,5 +14,5 @@ */ return [ - 'notImplemented' => "'{0}' action not implemented.", + 'notImplemented' => '"{0}" action not implemented.', ]; diff --git a/system/Language/en/Redirect.php b/system/Language/en/Redirect.php index 4d78f41..050b97b 100644 --- a/system/Language/en/Redirect.php +++ b/system/Language/en/Redirect.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Router.php b/system/Language/en/Router.php index 627ad67..97b76b5 100644 --- a/system/Language/en/Router.php +++ b/system/Language/en/Router.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Session.php b/system/Language/en/Session.php index 11df76e..5f0dabd 100644 --- a/system/Language/en/Session.php +++ b/system/Language/en/Session.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -16,8 +16,8 @@ return [ 'missingDatabaseTable' => '`sessionSavePath` must have the table name for the Database Session Handler to work.', - 'invalidSavePath' => "Session: Configured save path '{0}' is not a directory, doesn't exist or cannot be created.", - 'writeProtectedSavePath' => "Session: Configured save path '{0}' is not writable by the PHP process.", + 'invalidSavePath' => 'Session: Configured save path "{0}" is not a directory, does not exist or cannot be created.', + 'writeProtectedSavePath' => 'Session: Configured save path "{0}" is not writable by the PHP process.', 'emptySavePath' => 'Session: No save path configured.', 'invalidSavePathFormat' => 'Session: Invalid Redis save path format: {0}', ]; diff --git a/system/Language/en/Time.php b/system/Language/en/Time.php index 62791c7..ece5f76 100644 --- a/system/Language/en/Time.php +++ b/system/Language/en/Time.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/Validation.php b/system/Language/en/Validation.php index 46754ef..c9e656f 100644 --- a/system/Language/en/Validation.php +++ b/system/Language/en/Validation.php @@ -5,7 +5,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Language/en/View.php b/system/Language/en/View.php index 85b988a..0c2a146 100644 --- a/system/Language/en/View.php +++ b/system/Language/en/View.php @@ -4,7 +4,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Log/Handlers/BaseHandler.php b/system/Log/Handlers/BaseHandler.php index 1611543..4b76f89 100644 --- a/system/Log/Handlers/BaseHandler.php +++ b/system/Log/Handlers/BaseHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Log/Handlers/ChromeLoggerHandler.php b/system/Log/Handlers/ChromeLoggerHandler.php index 67c15b4..6af3527 100644 --- a/system/Log/Handlers/ChromeLoggerHandler.php +++ b/system/Log/Handlers/ChromeLoggerHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Log/Handlers/FileHandler.php b/system/Log/Handlers/FileHandler.php index a74f01e..d83750e 100644 --- a/system/Log/Handlers/FileHandler.php +++ b/system/Log/Handlers/FileHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Log/Handlers/HandlerInterface.php b/system/Log/Handlers/HandlerInterface.php index 6c213c1..0e0d01b 100644 --- a/system/Log/Handlers/HandlerInterface.php +++ b/system/Log/Handlers/HandlerInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Log/Logger.php b/system/Log/Logger.php index 4ae7bd4..2219d57 100644 --- a/system/Log/Logger.php +++ b/system/Log/Logger.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Model.php b/system/Model.php index 60bd3bb..8749b2c 100644 --- a/system/Model.php +++ b/system/Model.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -687,11 +688,6 @@ } } - // Save the original data so it can be passed to - // any Model Event callbacks and not stripped - // by doProtectFields - $originalData = $data; - // Must be called first so we don't // strip out created_at values. $data = $this->doProtectFields($data); @@ -722,7 +718,8 @@ $this->insertID = $this->db->insertID(); } - $this->trigger('afterInsert', ['data' => $originalData, 'result' => $result]); + // Trigger afterInsert events with the inserted data and new ID + $this->trigger('afterInsert', ['id' => $this->insertID, 'data' => $data, 'result' => $result]); // If insertion failed, get out of here if (! $result) @@ -821,11 +818,6 @@ } } - // Save the original data so it can be passed to - // any Model Event callbacks and not stripped - // by doProtectFields - $originalData = $data; - // Must be called first so we don't // strip out updated_at values. $data = $this->doProtectFields($data); @@ -849,7 +841,7 @@ ->set($data['data'], '', $escape) ->update(); - $this->trigger('afterUpdate', ['id' => $id, 'data' => $originalData, 'result' => $result]); + $this->trigger('afterUpdate', ['id' => $id, 'data' => $data, 'result' => $result]); return $result; } @@ -1618,7 +1610,7 @@ */ public function __get(string $name) { - if (in_array($name, ['primaryKey', 'table', 'returnType', 'DBGroup'])) + if (property_exists($this, $name)) { return $this->{$name}; } @@ -1639,7 +1631,7 @@ * * @param string $name * - * @return bool + * @return boolean */ public function __isset(string $name): bool { diff --git a/system/Pager/Pager.php b/system/Pager/Pager.php index e70fdb6..b80b0e8 100644 --- a/system/Pager/Pager.php +++ b/system/Pager/Pager.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Pager/PagerInterface.php b/system/Pager/PagerInterface.php index c42ffc4..5a56bc4 100644 --- a/system/Pager/PagerInterface.php +++ b/system/Pager/PagerInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Pager/PagerRenderer.php b/system/Pager/PagerRenderer.php index e7ce557..c21ba40 100644 --- a/system/Pager/PagerRenderer.php +++ b/system/Pager/PagerRenderer.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/RESTful/ResourceController.php b/system/RESTful/ResourceController.php index 2b55226..3ca495d 100644 --- a/system/RESTful/ResourceController.php +++ b/system/RESTful/ResourceController.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 3.0.0 diff --git a/system/RESTful/ResourcePresenter.php b/system/RESTful/ResourcePresenter.php index d8e14f6..3ac0676 100644 --- a/system/RESTful/ResourcePresenter.php +++ b/system/RESTful/ResourcePresenter.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 3.0.0 @@ -177,12 +178,12 @@ { if (is_object($which)) { - $this->model = $which; + $this->model = $which; $this->modelName = null; } else { - $this->model = null; + $this->model = null; $this->modelName = $which; } } diff --git a/system/Router/Exceptions/RedirectException.php b/system/Router/Exceptions/RedirectException.php index c1f6862..5c3f695 100644 --- a/system/Router/Exceptions/RedirectException.php +++ b/system/Router/Exceptions/RedirectException.php @@ -8,8 +8,5 @@ class RedirectException extends \Exception { - public static function forUnableToRedirect(string $route, string $code) - { - return new static(lang('Redirect.forUnableToRedirect', [$route, $code])); - } + protected $code = 302; } diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index e5bf78f..6cc01b4 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Router/RouteCollectionInterface.php b/system/Router/RouteCollectionInterface.php index 78ef1c7..a6ae721 100644 --- a/system/Router/RouteCollectionInterface.php +++ b/system/Router/RouteCollectionInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Router/Router.php b/system/Router/Router.php index 843e842..185e94f 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -484,7 +485,7 @@ // Is this route supposed to redirect to another? if ($this->collection->isRedirect($key)) { - throw RedirectException::forUnableToRedirect($val, $this->collection->getRedirectCode($key)); + throw new RedirectException($val, $this->collection->getRedirectCode($key)); } $this->setRequest(explode('/', $val)); @@ -578,10 +579,9 @@ // Loop through our segments and return as soon as a controller // is found or when such a directory doesn't exist - while ($c -- > 0) + while ($c-- > 0) { - $test = $this->directory . ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0] - ); + $test = $this->directory . ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]); if (! is_file(APPPATH . 'Controllers/' . $test . '.php') && $directory_override === false && is_dir(APPPATH . 'Controllers/' . $this->directory . ucfirst($segments[0]))) { @@ -606,6 +606,11 @@ */ protected function setDirectory(string $dir = null, bool $append = false) { + if (empty($dir)) + { + return; + } + $dir = ucfirst($dir); if ($append !== true || empty($this->directory)) diff --git a/system/Router/RouterInterface.php b/system/Router/RouterInterface.php index 5c5056f..7adb860 100644 --- a/system/Router/RouterInterface.php +++ b/system/Router/RouterInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Security/Security.php b/system/Security/Security.php index a53525c..cef7815 100644 --- a/system/Security/Security.php +++ b/system/Security/Security.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -76,6 +77,15 @@ protected $CSRFTokenName = 'CSRFToken'; /** + * CSRF Header name + * + * Token name for Cross Site Request Forgery protection cookie. + * + * @var string + */ + protected $CSRFHeaderName = 'CSRFToken'; + + /** * CSRF Cookie name * * Cookie name for Cross Site Request Forgery protection cookie. @@ -171,6 +181,7 @@ // Store our CSRF-related settings $this->CSRFExpire = $config->CSRFExpire; $this->CSRFTokenName = $config->CSRFTokenName; + $this->CSRFHeaderName = $config->CSRFHeaderName; $this->CSRFCookieName = $config->CSRFCookieName; $this->CSRFRegenerate = $config->CSRFRegenerate; @@ -207,12 +218,14 @@ return $this->CSRFSetCookie($request); } - // Do the token exist in _POST or php://input (json) data? + // Do the tokens exist in _POST, HEADER or optionally php:://input - json data $CSRFTokenValue = $_POST[$this->CSRFTokenName] ?? - (!empty($input = file_get_contents('php://input')) && !empty($json = json_decode($input)) && json_last_error() === JSON_ERROR_NONE ? - ($json->{$this->CSRFTokenName} ?? null) : - null); - + (! is_null($request->getHeader($this->CSRFHeaderName)) && ! empty($request->getHeader($this->CSRFHeaderName)->getValue()) ? + $request->getHeader($this->CSRFHeaderName)->getValue() : + (! empty($request->getBody()) && ! empty($json = json_decode($request->getBody())) && json_last_error() === JSON_ERROR_NONE ? + ($json->{$this->CSRFTokenName} ?? null) : + null)); + // Do the tokens exist in both the _POST/POSTed JSON and _COOKIE arrays? if (! isset($CSRFTokenValue, $_COOKIE[$this->CSRFCookieName]) || $CSRFTokenValue !== $_COOKIE[$this->CSRFCookieName] ) // Do the tokens match? @@ -221,7 +234,17 @@ } // We kill this since we're done and we don't want to pollute the _POST array - unset($_POST[$this->CSRFTokenName]); + if (isset($_POST[$this->CSRFTokenName])) + { + unset($_POST[$this->CSRFTokenName]); + $request->setGlobal('post', $_POST); + } + // We kill this since we're done and we don't want to pollute the JSON data + elseif (isset($json->{$this->CSRFTokenName})) + { + unset($json->{$this->CSRFTokenName}); + $request->setBody(json_encode($json)); + } // Regenerate on every submission? if ($this->CSRFRegenerate) diff --git a/system/Session/Handlers/ArrayHandler.php b/system/Session/Handlers/ArrayHandler.php index 632509d..9f71ada 100644 --- a/system/Session/Handlers/ArrayHandler.php +++ b/system/Session/Handlers/ArrayHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Session/Handlers/BaseHandler.php b/system/Session/Handlers/BaseHandler.php index ee3e1ca..d9fa7fa 100644 --- a/system/Session/Handlers/BaseHandler.php +++ b/system/Session/Handlers/BaseHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Session/Handlers/DatabaseHandler.php b/system/Session/Handlers/DatabaseHandler.php index a20e2ec..77ed74f 100644 --- a/system/Session/Handlers/DatabaseHandler.php +++ b/system/Session/Handlers/DatabaseHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -164,7 +165,10 @@ } // Needed by write() to detect session_regenerate_id() calls - $this->sessionID = $sessionID; + if (is_null($this->sessionID)) + { + $this->sessionID = $sessionID; + } $builder = $this->db->table($this->table) ->select('data') @@ -228,11 +232,6 @@ // Was the ID regenerated? elseif ($sessionID !== $this->sessionID) { - if (! $this->releaseLock() || ! $this->lockSession($sessionID)) - { - return $this->fail(); - } - $this->rowExists = false; $this->sessionID = $sessionID; } diff --git a/system/Session/Handlers/FileHandler.php b/system/Session/Handlers/FileHandler.php index dd5ffac..f046b9d 100644 --- a/system/Session/Handlers/FileHandler.php +++ b/system/Session/Handlers/FileHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -187,7 +188,10 @@ } // Needed by write() to detect session_regenerate_id() calls - $this->sessionID = $sessionID; + if (is_null($this->sessionID)) + { + $this->sessionID = $sessionID; + } if ($this->fileNew) { @@ -203,6 +207,7 @@ } $session_data = ''; + clearstatcache(); // Address https://github.com/codeigniter4/CodeIgniter4/issues/2056 for ($read = 0, $length = filesize($this->filePath . $sessionID); $read < $length; $read += strlen($buffer)) { if (($buffer = fread($this->fileHandle, $length - $read)) === false) @@ -233,10 +238,9 @@ public function write($sessionID, $sessionData): bool { // If the two IDs don't match, we have a session_regenerate_id() call - // and we need to close the old handle and open a new one - if ($sessionID !== $this->sessionID && (! $this->close() || $this->read($sessionID) === false)) + if ($sessionID !== $this->sessionID) { - return false; + $this->sessionID = $sessionID; } if (! is_resource($this->fileHandle)) @@ -294,7 +298,7 @@ flock($this->fileHandle, LOCK_UN); fclose($this->fileHandle); - $this->fileHandle = $this->fileNew = $this->sessionID = null; + $this->fileHandle = $this->fileNew = null; return true; } diff --git a/system/Session/Handlers/MemcachedHandler.php b/system/Session/Handlers/MemcachedHandler.php index 45f59cf..0fa2486 100644 --- a/system/Session/Handlers/MemcachedHandler.php +++ b/system/Session/Handlers/MemcachedHandler.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -183,7 +184,10 @@ if (isset($this->memcached) && $this->lockSession($sessionID)) { // Needed by write() to detect session_regenerate_id() calls - $this->sessionID = $sessionID; + if (is_null($this->sessionID)) + { + $this->sessionID = $sessionID; + } $session_data = (string) $this->memcached->get($this->keyPrefix . $sessionID); $this->fingerprint = md5($session_data); diff --git a/system/Session/Handlers/RedisHandler.php b/system/Session/Handlers/RedisHandler.php index 9415638..900cd4b 100644 --- a/system/Session/Handlers/RedisHandler.php +++ b/system/Session/Handlers/RedisHandler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -184,7 +185,10 @@ if (isset($this->redis) && $this->lockSession($sessionID)) { // Needed by write() to detect session_regenerate_id() calls - $this->sessionID = $sessionID; + if (is_null($this->sessionID)) + { + $this->sessionID = $sessionID; + } $session_data = $this->redis->get($this->keyPrefix . $sessionID); is_string($session_data) ? $this->keyExists = true : $session_data = ''; diff --git a/system/Session/Session.php b/system/Session/Session.php index 80c87ea..d0960db 100644 --- a/system/Session/Session.php +++ b/system/Session/Session.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -305,7 +306,7 @@ ); //if (empty($this->sessionExpiration)) - if (!isset($this->sessionExpiration)) + if (! isset($this->sessionExpiration)) { $this->sessionExpiration = (int) ini_get('session.gc_maxlifetime'); } @@ -496,7 +497,7 @@ */ public function get(string $key = null) { - if (! empty($key) && $value = dot_array_search($key, $_SESSION)) + if (! empty($key) && ! is_null($value = dot_array_search($key, $_SESSION))) { return $value; } @@ -634,7 +635,7 @@ * * @param string $key Identifier of the session property to remove. * - * @return bool + * @return boolean */ public function __isset(string $key): bool { diff --git a/system/Session/SessionInterface.php b/system/Session/SessionInterface.php index 4fcb3bd..820419a 100644 --- a/system/Session/SessionInterface.php +++ b/system/Session/SessionInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/CIDatabaseTestCase.php b/system/Test/CIDatabaseTestCase.php index f63ca72..9e177fc 100644 --- a/system/Test/CIDatabaseTestCase.php +++ b/system/Test/CIDatabaseTestCase.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/CIUnitTestCase.php b/system/Test/CIUnitTestCase.php index b584824..4d2dc80 100644 --- a/system/Test/CIUnitTestCase.php +++ b/system/Test/CIUnitTestCase.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/ControllerResponse.php b/system/Test/ControllerResponse.php index aa82ceb..1215842 100644 --- a/system/Test/ControllerResponse.php +++ b/system/Test/ControllerResponse.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/ControllerTester.php b/system/Test/ControllerTester.php index 2523a41..ed8fac6 100644 --- a/system/Test/ControllerTester.php +++ b/system/Test/ControllerTester.php @@ -9,6 +9,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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,7 +31,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/DOMParser.php b/system/Test/DOMParser.php index 804178d..d0d6af8 100644 --- a/system/Test/DOMParser.php +++ b/system/Test/DOMParser.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/FeatureResponse.php b/system/Test/FeatureResponse.php index b71fcb2..362161f 100644 --- a/system/Test/FeatureResponse.php +++ b/system/Test/FeatureResponse.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/FeatureTestCase.php b/system/Test/FeatureTestCase.php index 229cfe3..356b38a 100644 --- a/system/Test/FeatureTestCase.php +++ b/system/Test/FeatureTestCase.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/Filters/CITestStreamFilter.php b/system/Test/Filters/CITestStreamFilter.php index f2233d2..449f688 100644 --- a/system/Test/Filters/CITestStreamFilter.php +++ b/system/Test/Filters/CITestStreamFilter.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Test/ReflectionHelper.php b/system/Test/ReflectionHelper.php index d8a314b..2719b44 100644 --- a/system/Test/ReflectionHelper.php +++ b/system/Test/ReflectionHelper.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Throttle/Throttler.php b/system/Throttle/Throttler.php index db0edf7..28b8fbe 100644 --- a/system/Throttle/Throttler.php +++ b/system/Throttle/Throttler.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Throttle/ThrottlerInterface.php b/system/Throttle/ThrottlerInterface.php index 337ee82..64111eb 100644 --- a/system/Throttle/ThrottlerInterface.php +++ b/system/Throttle/ThrottlerInterface.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Typography/Typography.php b/system/Typography/Typography.php index b835340..76ea176 100644 --- a/system/Typography/Typography.php +++ b/system/Typography/Typography.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Validation/CreditCardRules.php b/system/Validation/CreditCardRules.php index 5192bff..3b141c7 100644 --- a/system/Validation/CreditCardRules.php +++ b/system/Validation/CreditCardRules.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Validation/FileRules.php b/system/Validation/FileRules.php index 4109ae3..5d51000 100644 --- a/system/Validation/FileRules.php +++ b/system/Validation/FileRules.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -120,7 +121,7 @@ $params = explode(',', $params); $name = array_shift($params); - if(!($files = $this->request->getFileMultiple($name))) + if (! ($files = $this->request->getFileMultiple($name))) { $files = [$this->request->getFile($name)]; } @@ -160,7 +161,7 @@ $params = explode(',', $params); $name = array_shift($params); - if(!($files = $this->request->getFileMultiple($name))) + if (! ($files = $this->request->getFileMultiple($name))) { $files = [$this->request->getFile($name)]; } @@ -203,7 +204,7 @@ $params = explode(',', $params); $name = array_shift($params); - if(!($files = $this->request->getFileMultiple($name))) + if (! ($files = $this->request->getFileMultiple($name))) { $files = [$this->request->getFile($name)]; } @@ -215,7 +216,7 @@ return false; } - if (!in_array($file->getMimeType(), $params)) + if (! in_array($file->getMimeType(), $params)) { return false; } @@ -242,7 +243,7 @@ $params = explode(',', $params); $name = array_shift($params); - if(!($files = $this->request->getFileMultiple($name))) + if (! ($files = $this->request->getFileMultiple($name))) { $files = [$this->request->getFile($name)]; } @@ -254,7 +255,7 @@ return false; } - if (!in_array($file->getExtension(), $params)) + if (! in_array($file->getExtension(), $params)) { return false; } @@ -282,7 +283,7 @@ $params = explode(',', $params); $name = array_shift($params); - if(!($files = $this->request->getFileMultiple($name))) + if (! ($files = $this->request->getFileMultiple($name))) { $files = [$this->request->getFile($name)]; } @@ -303,7 +304,7 @@ $fileWidth = $info[0]; $fileHeight = $info[1]; - if ( $fileWidth > $allowedWidth || $fileHeight > $allowedHeight) + if ($fileWidth > $allowedWidth || $fileHeight > $allowedHeight) { return false; } diff --git a/system/Validation/FormatRules.php b/system/Validation/FormatRules.php index 37fb4d3..11d5ade 100644 --- a/system/Validation/FormatRules.php +++ b/system/Validation/FormatRules.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Validation/Rules.php b/system/Validation/Rules.php index 74b01e1..c27e045 100644 --- a/system/Validation/Rules.php +++ b/system/Validation/Rules.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index 2ffaf5d..c55e27c 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -646,9 +647,9 @@ // passed along from a redirect_with_input request. if (empty($this->errors) && ! is_cli()) { - if (isset($_SESSION) && session('_ci_validation_errors')) + if (isset($_SESSION, $_SESSION['_ci_validation_errors'])) { - $this->errors = unserialize($errors); + $this->errors = unserialize($_SESSION['_ci_validation_errors']); } } diff --git a/system/Validation/ValidationInterface.php b/system/Validation/ValidationInterface.php index 71620de..ba4981f 100644 --- a/system/Validation/ValidationInterface.php +++ b/system/Validation/ValidationInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/View/Cell.php b/system/View/Cell.php index c819dfe..ff92f02 100644 --- a/system/View/Cell.php +++ b/system/View/Cell.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -28,7 +29,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/View/Filters.php b/system/View/Filters.php index c82b585..f17c324 100644 --- a/system/View/Filters.php +++ b/system/View/Filters.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/View/Parser.php b/system/View/Parser.php index 7293c55..d24dad5 100644 --- a/system/View/Parser.php +++ b/system/View/Parser.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/View/Plugins.php b/system/View/Plugins.php index 9041e22..8ee80af 100644 --- a/system/View/Plugins.php +++ b/system/View/Plugins.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/View/RendererInterface.php b/system/View/RendererInterface.php index ee70112..7794afe 100644 --- a/system/View/RendererInterface.php +++ b/system/View/RendererInterface.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/system/View/Table.php b/system/View/Table.php index 1923a60..4d12143 100644 --- a/system/View/Table.php +++ b/system/View/Table.php @@ -7,6 +7,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2019, British Columbia Institute of Technology + * Copyright (c) 2019 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 diff --git a/system/View/View.php b/system/View/View.php index 2324457..5aaf3bc 100644 --- a/system/View/View.php +++ b/system/View/View.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 @@ -248,7 +249,7 @@ $this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']); - if (CI_DEBUG && (! isset($options['debug']) || $options['debug'] === true)) + if ($this->debug && (! isset($options['debug']) || $options['debug'] === true)) { $toolbarCollectors = config(\Config\Toolbar::class)->collectors; diff --git a/system/bootstrap.php b/system/bootstrap.php index f997e92..4694de4 100644 --- a/system/bootstrap.php +++ b/system/bootstrap.php @@ -8,6 +8,7 @@ * This content is released under the MIT License (MIT) * * Copyright (c) 2014-2019 British Columbia Institute of Technology + * Copyright (c) 2019 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 @@ -29,7 +30,7 @@ * * @package CodeIgniter * @author CodeIgniter Dev Team - * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) + * @copyright 2019 CodeIgniter Foundation * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 4.0.0 diff --git a/tests/_support/Config/MockAppConfig.php b/tests/_support/Config/MockAppConfig.php index 554e2dd..23eef13 100644 --- a/tests/_support/Config/MockAppConfig.php +++ b/tests/_support/Config/MockAppConfig.php @@ -16,6 +16,7 @@ public $CSRFProtection = false; public $CSRFTokenName = 'csrf_test_name'; + public $CSRFHeaderName = 'X-CSRF-TOKEN'; public $CSRFCookieName = 'csrf_cookie_name'; public $CSRFExpire = 7200; public $CSRFRegenerate = true;