From 0d4d250d0642113d0c5a68ea3f5b7553a1efeee4 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sat, 29 Aug 2026 07:47:39 -0600 Subject: [PATCH 1/2] fix: preserve uninitialized BoxLang attributes --- models/BaseEntity.cfc | 7 ++++++- tests/specs/integration/BaseEntity/MetadataSpec.cfc | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/models/BaseEntity.cfc b/models/BaseEntity.cfc index c98ffa7e..c5bf88fc 100644 --- a/models/BaseEntity.cfc +++ b/models/BaseEntity.cfc @@ -558,7 +558,12 @@ component accessors="true" { */ private void function syncVariablesScopeWithData() { for ( var key in retrieveAttributeNames( withVirtualColumns = false ) ) { - if ( variables.keyExists( key ) && !isReadOnlyAttribute( key ) ) { + var column = retrieveColumnForAlias( key ); + if ( + variables.keyExists( key ) && + !isReadOnlyAttribute( key ) && + ( variables._data.keyExists( column ) || !isNullValue( key, variables[ key ] ) ) + ) { assignAttribute( key, variables[ key ] ); } } diff --git a/tests/specs/integration/BaseEntity/MetadataSpec.cfc b/tests/specs/integration/BaseEntity/MetadataSpec.cfc index d5777e17..9ed128bd 100644 --- a/tests/specs/integration/BaseEntity/MetadataSpec.cfc +++ b/tests/specs/integration/BaseEntity/MetadataSpec.cfc @@ -114,6 +114,15 @@ component extends="tests.resources.ModuleIntegrationSpec" { }, skip = !server.keyExists( "boxlang" ) ); + + it( + title = "does not persist uninitialized BoxLang accessor values", + body = function() { + var user = getInstance( "User" ); + expect( user.retrieveAttributesData() ).notToHaveKey( "created_date" ); + }, + skip = !server.keyExists( "boxlang" ) + ); } ); } ); } From 8dbc19d33d58112fa7ab009c3e1d7cbfa5aa05a0 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sat, 29 Aug 2026 08:33:53 -0600 Subject: [PATCH 2/2] fix: preserve explicit null-equivalent values --- models/BaseEntity.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/BaseEntity.cfc b/models/BaseEntity.cfc index c5bf88fc..37bfedf6 100644 --- a/models/BaseEntity.cfc +++ b/models/BaseEntity.cfc @@ -562,7 +562,7 @@ component accessors="true" { if ( variables.keyExists( key ) && !isReadOnlyAttribute( key ) && - ( variables._data.keyExists( column ) || !isNullValue( key, variables[ key ] ) ) + ( variables._data.keyExists( column ) || !isNull( variables[ key ] ) ) ) { assignAttribute( key, variables[ key ] ); }