Skip to content

Commit c846112

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents f8b1a9b + 2250f03 commit c846112

File tree

10 files changed

+48
-20
lines changed

10 files changed

+48
-20
lines changed

app/Config/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Email extends BaseConfig
2626
public string $mailPath = '/usr/sbin/sendmail';
2727

2828
/**
29-
* SMTP Server Address
29+
* SMTP Server Hostname
3030
*/
3131
public string $SMTPHost = '';
3232

system/Database/BaseBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ public function getCompiledInsert(bool $reset = true)
22722272
*
22732273
* @param array|object|null $set
22742274
*
2275-
* @return bool
2275+
* @return BaseResult|bool|Query
22762276
*
22772277
* @throws DatabaseException
22782278
*/

system/Email/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Email
7373
public $protocol = 'mail';
7474

7575
/**
76-
* STMP Server host
76+
* STMP Server Hostname
7777
*
7878
* @var string
7979
*/

system/Honeypot/Honeypot.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public function hasContent(RequestInterface $request)
7676
*/
7777
public function attachHoneypot(ResponseInterface $response)
7878
{
79+
if ($response->getBody() === null) {
80+
return;
81+
}
82+
7983
if ($response->getCSP()->enabled()) {
8084
// Add id attribute to the container tag.
8185
$this->config->container = str_ireplace(

tests/system/Honeypot/HoneypotTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ public function testAttachHoneypot(): void
6969
$this->assertStringNotContainsString($this->config->name, $this->response->getBody());
7070
}
7171

72+
public function testAttachHoneypotBodyNull(): void
73+
{
74+
$this->response->setBody(null);
75+
76+
$this->honeypot->attachHoneypot($this->response);
77+
78+
$this->assertNull($this->response->getBody());
79+
}
80+
7281
public function testAttachHoneypotAndContainer(): void
7382
{
7483
$this->response->setBody('<form></form>');

user_guide_src/source/incoming/routing.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ and the ``productLookupByID()`` method passing in the match as a variable to the
6969

7070
.. literalinclude:: routing/009.php
7171

72+
.. _routing-http-verb-routes:
73+
7274
HTTP verb Routes
7375
================
7476

@@ -185,11 +187,20 @@ Placeholders Description
185187
.. note:: ``{locale}`` cannot be used as a placeholder or other part of the route, as it is reserved for use
186188
in :doc:`localization </outgoing/localization>`.
187189

188-
Note that a single ``(:any)`` will match multiple segments in the URL if present. For example the route:
190+
.. _routing-placeholder-any:
191+
192+
The Behavior of (:any)
193+
^^^^^^^^^^^^^^^^^^^^^^
194+
195+
Note that a single ``(:any)`` will match multiple segments in the URL if present.
196+
197+
For example the route:
189198

190199
.. literalinclude:: routing/010.php
191200

192-
will match **product/123**, **product/123/456**, **product/123/456/789** and so on. The implementation in the
201+
will match **product/123**, **product/123/456**, **product/123/456/789** and so on.
202+
203+
The implementation in the
193204
Controller should take into account the maximum parameters:
194205

195206
.. literalinclude:: routing/011.php

user_guide_src/source/installation/upgrade_emails.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Documentations
1414
What has been changed
1515
=====================
1616
- Only small things like the method names and the loading of the library have changed.
17+
- The behavior when using the SMTP protocol has been slightly changed. You may not be able to communicate with your SMTP server properly if you use the CI3 settings. See :ref:`email-ssl-tls-for-smtp` and :ref:`email-preferences`.
1718

1819
Upgrade Guide
1920
=============

user_guide_src/source/installation/upgrade_routing.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,22 @@ What has been changed
1717
- In CI4 the Auto Routing is disabled by default.
1818
- In CI4 the new more secure :ref:`auto-routing-improved` is introduced.
1919
- In CI4 the routing is no longer configured by setting the routes as array.
20+
- The Wildcard ``(:any)`` In CI3 will be the Placeholder ``(:segment)`` in CI4. The ``(:any)`` in CI4 matches multiple segements. See :ref:`URI Routing <routing-placeholder-any>`.
2021

2122
Upgrade Guide
2223
=============
2324

2425
1. If you use the Auto Routing in the same way as CI3, you need to enable :ref:`auto-routing-legacy`.
25-
2. The placeholder ``(:any)`` in CI3 will be ``(:segment)`` in CI4.
26-
3. You have to change the syntax of each routing line and append it in **app/Config/Routes.php**. For example:
26+
2. You have to change the syntax of each routing line and append it in **app/Config/Routes.php**. For example:
2727

2828
- ``$route['journals'] = 'blogs';`` to ``$routes->add('journals', 'Blogs::index');``. This would map to the ``index()`` method in the ``Blogs`` controller.
29-
- ``$route['product/(:any)'] = 'catalog/product_lookup';`` to ``$routes->add('product/(:segment)', 'Catalog::productLookup');``
29+
- ``$route['product/(:any)'] = 'catalog/product_lookup';`` to ``$routes->add('product/(:segment)', 'Catalog::productLookup');``. Don't forget to replace ``(:any)`` with ``(:segment)``.
3030
- ``$route['login/(.+)'] = 'auth/login/$1';`` to ``$routes->add('login/(.+)', 'Auth::login/$1');``
3131

32+
.. note:: For backward compatibility, ``$routes->add()`` is used here. But we
33+
strongly recommend to use :ref:`routing-http-verb-routes` like
34+
``$routes->get()`` instead of ``$routes->add()`` for security.
35+
3236
Code Example
3337
============
3438

@@ -43,3 +47,7 @@ CodeIgniter Version 4.x
4347
Path: **app/Config/Routes.php**:
4448

4549
.. literalinclude:: upgrade_routing/001.php
50+
51+
.. note:: For backward compatibility, ``$routes->add()`` is used here. But we
52+
strongly recommend to use :ref:`routing-http-verb-routes` like
53+
``$routes->get()`` instead of ``$routes->add()`` for security.
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
<?php
22

3-
namespace Config;
3+
use CodeIgniter\Router\RouteCollection;
44

5-
// ...
6-
7-
/*
8-
* --------------------------------------------------------------------
9-
* Route Definitions
10-
* --------------------------------------------------------------------
5+
/**
6+
* @var RouteCollection $routes
117
*/
12-
13-
// ...
8+
$routes->get('/', 'Home::index');
149

1510
$routes->add('posts/index', 'Posts::index');
1611
$routes->add('teams/create', 'Teams::create');
@@ -21,5 +16,3 @@
2116
$routes->add('drivers/create', 'Drivers::create');
2217
$routes->add('drivers/update', 'Drivers::update');
2318
$routes->add('posts/(:segment)', 'Posts::view/$1');
24-
25-
// ...

user_guide_src/source/libraries/email.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ The settings used for the last successful send are available from the
102102
instance property ``$archive``. This is helpful for testing and debugging
103103
to determine that actual values at the time of the ``send()`` call.
104104

105+
.. _email-preferences:
106+
105107
Email Preferences
106108
=================
107109

@@ -115,7 +117,7 @@ Preference Default Value Options Description
115117
**protocol** mail ``mail``, ``sendmail``, The mail sending protocol.
116118
or ``smtp``
117119
**mailPath** /usr/sbin/sendmail None The server path to Sendmail.
118-
**SMTPHost** No Default None SMTP Server Address.
120+
**SMTPHost** No Default None SMTP Server Hostname.
119121
**SMTPUser** No Default None SMTP Username.
120122
**SMTPPass** No Default None SMTP Password.
121123
**SMTPPort** 25 None SMTP Port. (If set to ``465``, TLS will be used for the connection

0 commit comments

Comments
 (0)