CodeIgniter4/installation/upgrade_412.html
2023-10-22 21:43:30 +00:00

507 lines
38 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Upgrading from 4.1.1 to 4.1.2 &mdash; CodeIgniter 4.4.2 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/citheme_dark.css" type="text/css" />
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/citheme.js"></script>
<script src="../_static/js/carbon.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Upgrading from 4.0.5 to 4.1.0 or 4.1.1" href="upgrade_410.html" />
<link rel="prev" title="Upgrading from 4.1.2 to 4.1.3" href="upgrade_413.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html">
<img src="../_static/ci-logo-text.svg" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../intro/index.html">Welcome to CodeIgniter4</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../intro/index.html">Welcome to CodeIgniter4</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro/requirements.html">Server Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro/credits.html">Credits</a></li>
<li class="toctree-l2"><a class="reference internal" href="../intro/psr.html">PSR Compliance</a></li>
<li class="toctree-l2"><a class="reference internal" href="../license.html">License Agreement</a></li>
</ul>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Installation</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="installing_composer.html">Composer Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="installing_manual.html">Manual Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="running.html">Running Your App</a></li>
<li class="toctree-l2"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../changelogs/index.html">Change Logs</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="upgrading.html">Upgrading From a Previous Version</a></li>
<li class="toctree-l2"><a class="reference internal" href="repositories.html">CodeIgniter Repositories</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Build Your First Application</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static Pages</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News Section</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create News Items</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../concepts/index.html">CodeIgniter4 Overview</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../concepts/structure.html">Application Structure</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/mvc.html">Models, Views, and Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/autoloader.html">Autoloading Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/services.html">Services</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/factories.html">Factories</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/http.html">Working with HTTP Requests</a></li>
<li class="toctree-l2"><a class="reference internal" href="../concepts/security.html">Security Guidelines</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../general/configuration.html">Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helper Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Global Functions and Constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/logging.html">Logging Information</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Web Page Caching</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/ajax.html">AJAX Requests</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/modules.html">Code Modules</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../incoming/index.html">Controllers and Routing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../incoming/routing.html">URI Routing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/controllers.html">Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/filters.html">Controller Filters</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/message.html">HTTP Messages</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/request.html">Request Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/incomingrequest.html">IncomingRequest Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/content_negotiation.html">Content Negotiation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/methodspoofing.html">HTTP Method Spoofing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../incoming/restful.html">RESTful Resource Handling</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../outgoing/index.html">Building Responses</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/views.html">Views</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_cells.html">View Cells</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_renderer.html">View Renderer</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_layouts.html">View Layouts</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_parser.html">View Parser</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/view_decorators.html">View Decorators</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/table.html">HTML Table Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/response.html">HTTP Responses</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/api_responses.html">API Response Trait</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/localization.html">Localization</a></li>
<li class="toctree-l2"><a class="reference internal" href="../outgoing/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../database/index.html">Working with Databases</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/events.html">Database Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../models/index.html">Modeling Data</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../models/model.html">Using CodeIgniter's Model</a></li>
<li class="toctree-l2"><a class="reference internal" href="../models/entities.html">Using Entity Classes</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../dbmgmt/index.html">Managing Databases</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/forge.html">Database Manipulation with Database Forge</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/migration.html">Database Migrations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/seeds.html">Database Seeding</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dbmgmt/db_commands.html">Database Commands</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../libraries/index.html">Library Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../libraries/caching.html">Caching Driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/cookies.html">Cookies</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/curlrequest.html">CURLRequest Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/email.html">Email Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/encryption.html">Encryption Service</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/files.html">Working with Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/file_collections.html">File Collections</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/honeypot.html">Honeypot Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/images.html">Image Manipulation Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/pagination.html">Pagination</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/publisher.html">Publisher</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/security.html">Security</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/sessions.html">Session Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/throttler.html">Throttler</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/time.html">Times and Dates</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/typography.html">Typography</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/uploaded_files.html">Working with Uploaded Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/uri.html">Working with URIs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/user_agent.html">User Agent Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../libraries/validation.html">Validation</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/filesystem_helper.html">Filesystem Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/test_helper.html">Test Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../testing/index.html">Testing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../testing/overview.html">Getting Started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/database.html">Database</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/fabricator.html">Generating Data</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/controllers.html">Controller Testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/feature.html">HTTP Testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/response.html">Testing Responses</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/benchmark.html">Benchmarking</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/debugging.html">Debugging Your Application</a></li>
<li class="toctree-l2"><a class="reference internal" href="../testing/mocking.html">Mocking</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../cli/index.html">Command Line Usage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_overview.html">CLI Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_controllers.html">Running Controllers via CLI</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/spark_commands.html">Spark Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_commands.html">Creating Spark Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_generators.html">CLI Generators</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_library.html">CLI Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cli/cli_request.html">CLIRequest Class</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../extending/index.html">Extending CodeIgniter</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../extending/core_classes.html">Creating Core System Classes</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/common.html">Replacing Common Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/events.html">Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/basecontroller.html">Extending the Controller</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/authentication.html">Authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/composer_packages.html">Creating Composer Packages</a></li>
<li class="toctree-l2"><a class="reference internal" href="../extending/contributing.html">Contributing to CodeIgniter</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../libraries/official_packages.html">Official Packages</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">CodeIgniter</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<a class="btn btn-neutral float-right" href="https://github.com/codeigniter4/CodeIgniter4/edit/develop/user_guide_src/source/installation/upgrade_412.rst">Edit this page</a>
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="index.html">Installation</a></li>
<li class="breadcrumb-item"><a href="upgrading.html">Upgrading From a Previous Version</a></li>
<li class="breadcrumb-item active">Upgrading from 4.1.1 to 4.1.2</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="upgrading-from-4-1-1-to-4-1-2">
<h1>Upgrading from 4.1.1 to 4.1.2<a class="headerlink" href="#upgrading-from-4-1-1-to-4-1-2" title="Permalink to this headline"></a></h1>
<p>Please refer to the upgrade instructions corresponding to your installation method.</p>
<ul class="simple">
<li><p><a class="reference internal" href="installing_composer.html#app-starter-upgrading"><span class="std std-ref">Composer Installation App Starter Upgrading</span></a></p></li>
<li><p><a class="reference internal" href="installing_composer.html#adding-codeigniter4-upgrading"><span class="std std-ref">Composer Installation Adding CodeIgniter4 to an Existing Project Upgrading</span></a></p></li>
<li><p><a class="reference internal" href="installing_manual.html#installing-manual-upgrading"><span class="std std-ref">Manual Installation Upgrading</span></a></p></li>
</ul>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#breaking-changes" id="id1">Breaking Changes</a></p>
<ul>
<li><p><a class="reference internal" href="#current-url-and-indexpage" id="id2">current_url() and indexPage</a></p></li>
<li><p><a class="reference internal" href="#cache-keys" id="id3">Cache Keys</a></p></li>
<li><p><a class="reference internal" href="#baseconnection-query-return-values" id="id4">BaseConnection::query() Return Values</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#breaking-enhancements" id="id5">Breaking Enhancements</a></p>
<ul>
<li><p><a class="reference internal" href="#connectioninterface-iswritetype-declaration-added" id="id6">ConnectionInterface::isWriteType() Declaration Added</a></p></li>
<li><p><a class="reference internal" href="#test-traits" id="id7">Test Traits</a></p></li>
<li><p><a class="reference internal" href="#test-responses" id="id8">Test Responses</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#project-files" id="id9">Project Files</a></p>
<ul>
<li><p><a class="reference internal" href="#content-changes" id="id10">Content Changes</a></p></li>
<li><p><a class="reference internal" href="#all-changes" id="id11">All Changes</a></p></li>
</ul>
</li>
</ul>
</div>
<section id="breaking-changes">
<h2><a class="toc-backref" href="#id1">Breaking Changes</a><a class="headerlink" href="#breaking-changes" title="Permalink to this headline"></a></h2>
<section id="current-url-and-indexpage">
<h3><a class="toc-backref" href="#id2">current_url() and indexPage</a><a class="headerlink" href="#current-url-and-indexpage" title="Permalink to this headline"></a></h3>
<p>Due to <a class="reference external" href="https://github.com/codeigniter4/CodeIgniter4/issues/4116">a bug</a> in <code class="docutils literal notranslate"><span class="pre">current_url()</span></code>,
the resulting URIs could be incorrect for a projects configuration, most importantly: <code class="docutils literal notranslate"><span class="pre">indexPage</span></code>
would <em>not</em> be included. Projects using <code class="docutils literal notranslate"><span class="pre">App::$indexPage</span></code> should expect altered values from
<code class="docutils literal notranslate"><span class="pre">current_url()</span></code> and all its dependencies (including Response Testing, Pager, Form Helper, Pager,
and View Parser). Update your projects accordingly.</p>
</section>
<section id="cache-keys">
<h3><a class="toc-backref" href="#id3">Cache Keys</a><a class="headerlink" href="#cache-keys" title="Permalink to this headline"></a></h3>
<p>Cache handlers had wildly different compatibility for keys. The updated cache drivers now pass
all keys through validation, roughly matching PSR-6s recommendations:</p>
<blockquote>
<div><p>A string of at least one character that uniquely identifies a cached item. Implementing libraries
MUST support keys consisting of the characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding
and a length of up to 64 characters. Implementing libraries MAY support additional characters and
encodings or longer lengths, but must support at least that minimum. Libraries are responsible for
their own escaping of key strings as appropriate, but MUST be able to return the original unmodified
key string. The following characters are reserved for future extensions and MUST NOT be supported by
implementing libraries: <code class="docutils literal notranslate"><span class="pre">{}()/\&#64;:</span></code></p>
</div></blockquote>
<p>Update your projects to remove any invalid cache keys.</p>
</section>
<section id="baseconnection-query-return-values">
<h3><a class="toc-backref" href="#id4">BaseConnection::query() Return Values</a><a class="headerlink" href="#baseconnection-query-return-values" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">BaseConnection::query()</span></code> method in prior versions was incorrectly returning BaseResult objects
even if the query failed. This method will now return <code class="docutils literal notranslate"><span class="pre">false</span></code> for failed queries (or throw an
Exception if <code class="docutils literal notranslate"><span class="pre">DBDebug</span></code> is <code class="docutils literal notranslate"><span class="pre">true</span></code>) and will return booleans for write-type queries. Review any use
of <code class="docutils literal notranslate"><span class="pre">query()</span></code> method and assess whether the value might be boolean instead of Result object.
For a better idea of what queries are write-type queries, check <code class="docutils literal notranslate"><span class="pre">BaseConnection::isWriteType()</span></code>
and any DBMS-specific override <code class="docutils literal notranslate"><span class="pre">isWriteType()</span></code> in the relevant Connection class.</p>
</section>
</section>
<section id="breaking-enhancements">
<h2><a class="toc-backref" href="#id5">Breaking Enhancements</a><a class="headerlink" href="#breaking-enhancements" title="Permalink to this headline"></a></h2>
<section id="connectioninterface-iswritetype-declaration-added">
<h3><a class="toc-backref" href="#id6">ConnectionInterface::isWriteType() Declaration Added</a><a class="headerlink" href="#connectioninterface-iswritetype-declaration-added" title="Permalink to this headline"></a></h3>
<p>If you have written any classes that implement ConnectionInterface, these must now implement the
<code class="docutils literal notranslate"><span class="pre">isWriteType()</span></code> method, declared as <code class="docutils literal notranslate"><span class="pre">public</span> <span class="pre">function</span> <span class="pre">isWriteType($sql):</span> <span class="pre">bool</span></code>. If your class extends BaseConnection, then that class will provide a basic <code class="docutils literal notranslate"><span class="pre">isWriteType()</span></code>
method which you might want to override.</p>
</section>
<section id="test-traits">
<h3><a class="toc-backref" href="#id7">Test Traits</a><a class="headerlink" href="#test-traits" title="Permalink to this headline"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">CodeIgniter\Test</span></code> namespace has had significant improvements to help developers with their
own test cases. Most notably test extensions have moved to Traits to make them easier to
pick-and-choose across various test case needs. The <code class="docutils literal notranslate"><span class="pre">CIDatabaseTestCase</span></code> and <code class="docutils literal notranslate"><span class="pre">FeatureTestCase</span></code>
classes have been deprecated and their methods moved to <code class="docutils literal notranslate"><span class="pre">DatabaseTestTrait</span></code> and
<code class="docutils literal notranslate"><span class="pre">FeatureTestTrait</span></code> respectively. Update your test cases to extend the main test case
and use any traits you need. For example:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="k">use</span> <span class="nx">CodeIgniter\Test\DatabaseTestCase</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">MyDatabaseTest</span> <span class="k">extends</span> <span class="nx">DatabaseTestCase</span>
<span class="p">{</span>
<span class="k">public</span> <span class="k">function</span> <span class="nf">testBadRow</span><span class="p">()</span>
<span class="p">{</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>… becomes:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="k">use</span> <span class="nx">CodeIgniter\Test\CIUnitTestCase</span><span class="p">;</span>
<span class="k">use</span> <span class="nx">CodeIgniter\Test\DatabaseTestTrait</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">MyDatabaseTest</span> <span class="k">extends</span> <span class="nx">CIUnitTestCase</span>
<span class="p">{</span>
<span class="k">use</span> <span class="nx">DatabaseTestTrait</span><span class="p">;</span>
<span class="k">public</span> <span class="k">function</span> <span class="nf">testBadRow</span><span class="p">()</span>
<span class="p">{</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Finally, <code class="docutils literal notranslate"><span class="pre">ControllerTester</span></code> has been superseded by <code class="docutils literal notranslate"><span class="pre">ControllerTestTrait</span></code> to standardize
approach and take advantage of the updated response testing (below).</p>
</section>
<section id="test-responses">
<h3><a class="toc-backref" href="#id8">Test Responses</a><a class="headerlink" href="#test-responses" title="Permalink to this headline"></a></h3>
<p>The tools for testing responses have been consolidated and improved. A new
<code class="docutils literal notranslate"><span class="pre">TestResponse</span></code> replaces <code class="docutils literal notranslate"><span class="pre">ControllerResponse</span></code> and <code class="docutils literal notranslate"><span class="pre">FeatureResponse</span></code> with a complete
set of methods and properties expected from both those classes. In most cases these changes
will be “behind the scenes” by <code class="docutils literal notranslate"><span class="pre">ControllerTestTrait</span></code> and <code class="docutils literal notranslate"><span class="pre">FeatureTestCase</span></code>, but two
changes to be aware of:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">TestResponse</span></code>s <code class="docutils literal notranslate"><span class="pre">$request</span></code> and <code class="docutils literal notranslate"><span class="pre">$response</span></code> properties are protected and should only be access through their getter methods, <code class="docutils literal notranslate"><span class="pre">request()</span></code> and <code class="docutils literal notranslate"><span class="pre">response()</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">TestResponse</span></code> does not have <code class="docutils literal notranslate"><span class="pre">getBody()</span></code> and <code class="docutils literal notranslate"><span class="pre">setBody()</span></code> methods, but rather uses the Response methods directly, e.g.: <code class="docutils literal notranslate"><span class="pre">$body</span> <span class="pre">=</span> <span class="pre">$result-&gt;response()-&gt;getBody();</span></code></p></li>
</ul>
</section>
</section>
<section id="project-files">
<h2><a class="toc-backref" href="#id9">Project Files</a><a class="headerlink" href="#project-files" title="Permalink to this headline"></a></h2>
<p>Numerous files in the project space (root, app, public, writable) received updates. Due to
these files being outside of the system scope they will not be changed without your intervention.
There are some third-party CodeIgniter modules available to assist with merging changes to
the project space: <a class="reference external" href="https://packagist.org/explore/?query=codeigniter4%20updates">Explore on Packagist</a>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Except in very rare cases for bug fixes, no changes made to files for the project space
will break your application. All changes noted here are optional until the next major version,
and any mandatory changes will be covered in the sections above.</p>
</div>
<section id="content-changes">
<h3><a class="toc-backref" href="#id10">Content Changes</a><a class="headerlink" href="#content-changes" title="Permalink to this headline"></a></h3>
<p>The following files received significant changes (including deprecations or visual adjustments)
and it is recommended that you merge the updated versions with your application:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/App.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Autoload.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Cookie.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Events.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Exceptions.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Security.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Views/errors/html/*</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">env</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">spark</span></code></p></li>
</ul>
</section>
<section id="all-changes">
<h3><a class="toc-backref" href="#id11">All Changes</a><a class="headerlink" href="#all-changes" title="Permalink to this headline"></a></h3>
<p>This is a list of all files in the project space that received changes;
many will be simple comments or formatting that have no effect on the runtime:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/App.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Autoload.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/ContentSecurityPolicy.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Cookie.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Events.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Exceptions.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Logger.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Mimes.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Modules.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Config/Security.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Controllers/BaseController.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Views/errors/html/debug.css</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Views/errors/html/error_404.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Views/errors/html/error_exception.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">app/Views/welcome_message.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">composer.json</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">contributing/guidelines.rst</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">env</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">phpstan.neon.dist</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">phpunit.xml.dist</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">public/.htaccess</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">public/index.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">rector.php</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">spark</span></code></p></li>
</ul>
</section>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="upgrade_413.html" class="btn btn-neutral float-left" title="Upgrading from 4.1.2 to 4.1.3" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="upgrade_410.html" class="btn btn-neutral float-right" title="Upgrading from 4.0.5 to 4.1.0 or 4.1.1" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2019-2023 CodeIgniter Foundation.
<span class="lastupdated">Last updated on Oct 22, 2023.
</span></p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(false);
});
</script>
</body>
</html>