Skip to content

Commit 35ca681

Browse files
Refactor DIProperties check to use array indexing and structKeyExists for improved safety
1 parent 36f4a58 commit 35ca681

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

system/ioc/config/Mapping.cfc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,11 @@ component accessors="true" {
441441
delegateIncludes = []
442442
){
443443
// check if already registered, if it is, just return
444-
for ( var thisProperty in variables.DIProperties ) {
445-
if ( thisProperty.name eq arguments.name ) {
444+
for ( var x = 1; x lte arrayLen( variables.DIProperties ); x++ ) {
445+
if (
446+
structKeyExists( variables.DIProperties[ x ], "name" ) AND
447+
variables.DIProperties[ x ].name == arguments.name
448+
) {
446449
return this;
447450
}
448451
}

0 commit comments

Comments
 (0)