Skip to content

fix: preserve zero values in XML export#10367

Open
gr8man wants to merge 1 commit into
codeigniter4:developfrom
gr8man:fix/xml-export-zero-value
Open

fix: preserve zero values in XML export#10367
gr8man wants to merge 1 commit into
codeigniter4:developfrom
gr8man:fix/xml-export-zero-value

Conversation

@gr8man

@gr8man gr8man commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description
In BaseUtils::getXMLFromResult(), database values of 0 or '0' were incorrectly treated as empty and replaced with empty strings ('') in the generated XML export due to the use of the empty() check.

This PR replaces empty($val) with a strict comparison ($val === null || $val === '') to ensure that zero values are preserved in the exported XML, while still correctly replacing actual null and empty string values with an empty element value.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Please rebase:

git rebase upstream/develop

Update PHPStan baseline:

composer phpstan:baseline

And later, push changes:

git push --force-with-lease origin fix/xml-export-zero-value

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 2, 2026
@gr8man gr8man force-pushed the fix/xml-export-zero-value branch from 71e92f6 to 0f26db4 Compare July 2, 2026 19:50
@gr8man gr8man force-pushed the fix/xml-export-zero-value branch from 0f26db4 to abeb4c7 Compare July 2, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants