Bug in Wirebox with nullSupport

Hi everyone,

I am writing here to report an error we are experiencing with wirebox and Lucee.

Below is our Application.cfc with null support set to true.

component{

    this.name           = "test-wirebox";
    this.nullSupport    = true;

    public boolean function onRequestStart(){

        var wirebox = new wirebox.system.ioc.Injector("config.WireboxBinderService");
        return true;

    }

}

WireboxBinderService.cfc

component extends="wirebox.system.ioc.config.Binder" {

    function configure() {

        wireBox = {
            scopeRegistration = {
                enabled = true,
                scope   = "server", // server, cluster, session, application
                key     = "wireBox-test-lucee"
            }
        };
    }

}

When null support is set to false (in Application.cfc) everything work fine.

But, i set it to true, I get this error:

In order to fix this we have to access Lucee admin server and set null support to “complete”. (“Partial” support is default).

complete-support

Why is this happening and how could we fix it?

Many thanks!

1 Like

Just to be clear, are you saying you get error when you set this.nullSupport = true; in the Application.cfc, but when you set the setting in the Admin UI, it works? For all I knew, those were the same setting!

Yes, it’s correct.

I tried with lucee-5.3.7 and lucee-5.3.8.

You can test downloading this file:
https://tetilab.info/test-wirebox.zip

Simply, unzip it in webroot of a CommandBox server.

Many thanks :hugs:

1 Like

Add some info:

Error is:

"The function [configure] does not exist in the Object"

in line 76 of ioc/config/Binder.cfc:

arguments.config.configure(this)

Analyzing of line 72 of ioc/config/Binder.cfc:

if( structKeyExists(arguments,"config") and isObject(arguments.config) ){


with nullSupport = false

SerializeJSON(arguments) => {"injector":[OTHER-KEY]"scopes":{},"injectorID":1527395062},"properties":{}}

IsNull(arguments.config) => true

StructKeyExists(arguments,"config") => false

without nullSupport = true
(ARGUMENTS CONTAINS KEY “CONFIG” SET TO NULL)


SerializeJSON(arguments) => {"injector":[OTHER-KEY],"scopes":{},"injectorID":679639919},"config":null,"properties":{}}

IsNull(arguments.config) => true

StructKeyExists(arguments,"config") => true

with nullSupport Wirebox raises an exception because:

  • structKeyExists(arguments,"config")

and

  • isObject(arguments.config)

are both “true” and enters in if statment

Whene we add the !IsNull check it works:

if( structKeyExists(arguments,"config") 
      and isObject(arguments.config) 
      and !IsNull(arguments.config) ){
}

Thanks

Thanks for helping research. It sounds like there are two issues here. The first is that the application.cfc setting bahaves differently than the admin setting. This is a Lucee bug, if it’s true.

The second issue is that wirebox needs to be using an isnull check instead if StructKeyExists. Can you put in a ticket for the second issue in our Ortus bug tracker?

I believe you are using an older version of WireBox/ColdBox. This was changed several minor fixes ago.

// If sent and a data CFC variables
		if ( !isNull( arguments.config ) and isObject( arguments.config ) ) {
			// Decorate our data CFC
			arguments.config.getPropertyMixin = variables.injector.getUtil().getMixerUtil().getPropertyMixin;
			// Execute the configuration
			arguments.config.configure( this );
			// Load the raw data DSL
			loadDataDSL( arguments.config.getPropertyMixin( "wireBox", "variables", {} ) );
		}

@Roberto_Marzialetti Can confirm if just updating to the latest Coldbox.Wirebox solves your issue?

Hi everyone.

Yes. We upgrade WB to last version and this solved the issue.

Many thanks!