Bug in Form App. Inconsisten behaviour in processing NULL field

I have found a severe bug in version 9.11.016 of SC.

How to reproduce this bug.

  1. Create a form application against an already populated table of the database that contains an integer column called F which is nullable

  2. In the form app define F as nullable and define NULL as default value on Update and Insert in the database

  3. Echo (print) the value of the field in these events: OnValidate, ,OnBeforeUpdate, and OnAfterUpdate

  4. Run the form

  5. Save the form leaving the field F as blank.

  6. Observe the value of F in each event

  7. OnValidate F=0, OnBeforeUpdate F is blank, OnAfterUpdate F is assigned the string null !!!

This is an inconsistent behaviour.

In previous version of SC the database was updated with NULL but the value of the field F in the OnAfterUpdate event was not assigned to the string null but left blank.

Becasue of this bug any PHP logic in the OnAfterUpdate event like:

if(empty(F)) then …

will not work because F is not empty , as it is assigned the lowercase string null.

Moroever an integer field cannot became a string in the OnAfterUpdate event !

1 Like