Skip to content

Commit 31342ca

Browse files
committed
Merge branch 'v1.x' into v2.x
2 parents 2bb7613 + 4122225 commit 31342ca

3 files changed

Lines changed: 14 additions & 16 deletions

File tree

BaseMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function map(array $row, array $dataTypes): BaseModel
8484
),
8585
'int' => (int)$val,
8686
'bool' => $this->getBoolValue($val),
87-
default => utf8_encode((string)$val)
87+
default => mb_convert_encoding((string)$val, 'UTF-8', ['ISO-8859-1', 'UTF-8'])
8888
};
8989
}
9090
}

FeastTests/IdentityTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
declare(strict_types=1);
1919

2020
use Feast\Interfaces\ConfigInterface;
21-
use Feast\ServiceContainer\ServiceContainer;
2221
use Feast\Session\Identity;
2322
use Feast\Session\Session;
2423
use Mocks\MockUser;
@@ -63,16 +62,14 @@ public function testSaveUser(): void
6362
{
6463
di(null, \Feast\Enums\ServiceContainer::CLEAR_CONTAINER);
6564
$session = $this->createStub(Session::class);
66-
$namespace = new stdClass();
67-
$session->Feast_Login = $namespace;
6865

6966
$config = $this->createStub(ConfigInterface::class);
7067
$config->method('getSetting')->willReturn('test');
7168

7269
$testUser = new MockUser();
7370
$testUser->user = 'testUser';
74-
$namespace->identity = $testUser;
75-
$identity = new Identity($config,$session);
71+
$identity = new Identity($config, $session);
72+
7673
$user = $identity->getUser();
7774
$this->assertEquals(null, $user);
7875

@@ -85,8 +82,6 @@ public function testDestroyUser(): void
8582
{
8683
di(null, \Feast\Enums\ServiceContainer::CLEAR_CONTAINER);
8784
$session = $this->createStub(Session::class);
88-
$namespace = new stdClass();
89-
$session->Feast_Login = $namespace;
9085

9186
$config = $this->createStub(ConfigInterface::class);
9287
$config->method('getSetting')->willReturn('test');

HttpRequest/Response.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,30 @@
2727

2828
class Response
2929
{
30-
3130
public function __construct(protected string $rawResponse, protected ResponseCode $responseCode)
3231
{
33-
3432
}
35-
36-
public function getResponseAsText(): string {
33+
34+
public function getResponseAsText(): string
35+
{
3736
return $this->rawResponse;
3837
}
3938

4039
public function getResultAsJson(): stdClass|array|null
4140
{
4241
try {
43-
/** @var stdClass|array */
44-
return json_decode(utf8_encode($this->rawResponse), flags: JSON_THROW_ON_ERROR);
42+
/** @var stdClass */
43+
return json_decode(
44+
mb_convert_encoding($this->rawResponse, 'UTF-8', ['ISO-8859-1', 'UTF-8']),
45+
flags: JSON_THROW_ON_ERROR
46+
);
4547
} catch (Exception) {
4648
return null;
4749
}
4850
}
49-
50-
public function getResultAsXml(): ?SimpleXMLElement {
51+
52+
public function getResultAsXml(): ?SimpleXMLElement
53+
{
5154
try {
5255
return new SimpleXMLElement($this->rawResponse, LIBXML_NOERROR | LIBXML_NOWARNING);
5356
} catch (Exception) {

0 commit comments

Comments
 (0)