Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/Database/BaseUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function getXMLFromResult(ResultInterface $query, array $params = []): st
$xml .= $tab . '<' . $element . '>' . $newline;

foreach ($row as $key => $val) {
$val = empty($val) ? '' : xml_convert((string) $val);
$val = ($val === null || $val === '') ? '' : xml_convert((string) $val);

$xml .= $tab . $tab . '<' . $key . '>' . $val . '</' . $key . '>' . $newline;
}
Expand Down
20 changes: 20 additions & 0 deletions tests/system/Database/Live/DbUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,24 @@ public function testUtilsXMLFromResult(): void

$this->assertSame($expected, $actual);
}

public function testUtilsXMLFromResultWithZero(): void
{
$this->db->table('job')->insert([
'name' => '0',
'description' => 'Testing zero value',
]);
$data = $this->db->table('job')->where('name', '0')->get();

$util = (new Database())->loadUtils($this->db);

$data = $util->getXMLFromResult($data);

$expected = '<root><element><id>5</id><name>0</name><description>Testing zero value</description><created_at></created_at><updated_at></updated_at><deleted_at></deleted_at></element></root>';

$actual = preg_replace('#\R+#', '', $data);
$actual = preg_replace('/[ ]{2,}|[\t]/', '', $actual);

$this->assertSame($expected, $actual);
}
}
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.7.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Bugs Fixed
- **Commands:** Fixed a bug where ``spark lang:find`` treated translation keys already provided by the framework or another namespace (such as ``Errors.*`` in ``system/Language``) as new, listing them under ``--show-new`` and writing untranslated placeholders into ``app/Language`` that overrode the existing translations.
- **Config:** Fixed a bug where ``BaseService::injectMock`` did not apply ``strtolower`` consistently, causing inconsistent Service and Mock registration and resolution.
- **Database:** Fixed a bug where ``updateBatch()`` could be called after Query Builder ``where()`` conditions, even though it's not supported. In this situation, now the ``DatabaseException`` is thrown.
- **Database:** Fixed a bug in ``BaseUtils::getXMLFromResult()`` where database values of ``0`` or ``'0'`` were treated as empty and omitted from the generated XML export.
- **Encryption:** Fixed bugs in ``SodiumHandler`` where runtime ``blockSize`` overrides without ``key`` were handled incorrectly, invalid key lengths could leak native Sodium errors, and mismatched decrypt ``blockSize`` values could throw ``SodiumException`` instead of ``EncryptionException``.
- **Filters:** Fixed a bug in ``InvalidChars`` filter where invalid UTF-8 or control characters in array keys were not checked.
- **HTTP:** Fixed a bug where the User Agent library reported Safari's WebKit version instead of the browser version from the ``Version`` token.
Expand Down
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/empty.notAllowed.neon
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ parameters:

-
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
count: 4
count: 3
path: ../../system/Database/BaseUtils.php

-
Expand Down
Loading