Skip to content

Commit f414d79

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.3
2 parents e1b920f + 0a438b7 commit f414d79

3 files changed

Lines changed: 40 additions & 15 deletions

File tree

system/HTTP/Header.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,23 @@ class Header
2828
/**
2929
* The value of the header. May have more than one
3030
* value. If so, will be an array of strings.
31+
* E.g.,
32+
* [
33+
* 'foo',
34+
* [
35+
* 'bar' => 'fizz',
36+
* ],
37+
* 'baz' => 'buzz',
38+
* ]
3139
*
32-
* @var array<array<string>|string>|string
40+
* @var array<int|string, array<string, string>|string>|string
3341
*/
3442
protected $value;
3543

3644
/**
3745
* Header constructor. name is mandatory, if a value is provided, it will be set.
3846
*
39-
* @param array<array<string>|string>|string|null $value
47+
* @param array<int|string, array<string, string>|string>|string|null $value
4048
*/
4149
public function __construct(string $name, $value = null)
4250
{
@@ -56,7 +64,7 @@ public function getName(): string
5664
* Gets the raw value of the header. This may return either a string
5765
* of an array, depending on whether the header has multiple values or not.
5866
*
59-
* @return array<array<string>|string>|string
67+
* @return array<int|string, array<string, string>|string>|string
6068
*/
6169
public function getValue()
6270
{
@@ -78,7 +86,7 @@ public function setName(string $name)
7886
/**
7987
* Sets the value of the header, overwriting any previous value(s).
8088
*
81-
* @param array<array<string>|string>|string|null $value
89+
* @param array<int|string, array<string, string>|string>|string|null $value
8290
*
8391
* @return $this
8492
*/
@@ -93,7 +101,7 @@ public function setValue($value = null)
93101
* Appends a value to the list of values for this header. If the
94102
* header is a single value string, it will be converted to an array.
95103
*
96-
* @param array<array<string>|string>|string|null $value
104+
* @param array<string, string>|string|null $value
97105
*
98106
* @return $this
99107
*/
@@ -118,7 +126,7 @@ public function appendValue($value = null)
118126
* Prepends a value to the list of values for this header. If the
119127
* header is a single value string, it will be converted to an array.
120128
*
121-
* @param array<array<string>|string>|string|null $value
129+
* @param array<string, string>|string|null $value
122130
*
123131
* @return $this
124132
*/

tests/system/HTTP/HeaderTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ public function testHeaderStoresArrayValues()
8080
$this->assertSame($value, $header->getValue());
8181
}
8282

83+
public function testHeaderStoresArrayKeyValue()
84+
{
85+
$name = 'foo';
86+
$value = [
87+
'key' => 'val',
88+
];
89+
90+
$header = new Header($name, $value);
91+
92+
$this->assertSame($name, $header->getName());
93+
$this->assertSame($value, $header->getValue());
94+
$this->assertSame('key=val', $header->getValueLine());
95+
}
96+
8397
public function testHeaderSetters()
8498
{
8599
$name = 'foo';

user_guide_src/source/database/transactions.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,21 @@ Running Transactions
3636
====================
3737

3838
To run your queries using transactions you will use the
39-
``$this->db->transStart()`` and ``$this->db->transComplete()`` functions as
39+
``$this->db->transStart()`` and ``$this->db->transComplete()`` methods as
4040
follows:
4141

4242
.. literalinclude:: transactions/001.php
4343

44-
You can run as many queries as you want between the start/complete
45-
functions and they will all be committed or rolled back based on the success
44+
You can run as many queries as you want between the ``transStart()``/``transComplete()``
45+
methods and they will all be committed or rolled back based on the success
4646
or failure of any given query.
4747

4848
Strict Mode
4949
===========
5050

5151
By default, CodeIgniter runs all transactions in Strict Mode. When strict
5252
mode is enabled, if you are running multiple groups of transactions, if
53-
one group fails all groups will be rolled back. If strict mode is
53+
one group fails all subsequent groups will be rolled back. If strict mode is
5454
disabled, each group is treated independently, meaning a failure of one
5555
group will not affect any others.
5656

@@ -61,9 +61,11 @@ Strict Mode can be disabled as follows:
6161
Managing Errors
6262
===============
6363

64-
If you have error reporting enabled in your Config/Database.php file
65-
you'll see a standard error message if the commit was unsuccessful. If
66-
debugging is turned off, you can manage your own errors like this:
64+
When you have ``DBDebug`` true in your **app/Config/Database.php** file,
65+
if a query error occurs, all the queries will be rolled backed, and an exception
66+
will be thrown. So you'll see a standard error page.
67+
68+
If the ``DBDebug`` is false, you can manage your own errors like this:
6769

6870
.. literalinclude:: transactions/003.php
6971

@@ -84,14 +86,15 @@ Test Mode
8486
You can optionally put the transaction system into "test mode", which
8587
will cause your queries to be rolled back -- even if the queries produce
8688
a valid result. To use test mode simply set the first parameter in the
87-
``$this->db->transStart()`` function to true:
89+
``$this->db->transStart()`` method to true:
8890

8991
.. literalinclude:: transactions/005.php
9092

9193
Running Transactions Manually
9294
=============================
9395

94-
If you would like to run transactions manually you can do so as follows:
96+
When you have ``DBDebug`` false in your **app/Config/Database.php** file, and
97+
if you would like to run transactions manually you can do so as follows:
9598

9699
.. literalinclude:: transactions/006.php
97100

0 commit comments

Comments
 (0)