Uploaded image for project: 'Lucee Development'
  1. LDEV-716

Identical function returns different result when called as BIF vs. UDF

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.5.3.002
    • Fix Version/s: 5.0.1.79
    • Labels:
      None

      Description

      I have a function which is shorthand for creating MongoDBObject where the order of elements in the object must be preserved (i.e. for sort, or create index operations):

      function MongoDBObject(){
      	var DBObject = createobject("java","com.mongodb.BasicDBObjectBuilder").start();
      	var key = "";
      
      	for (key in arguments) {
      		DBObject.append( key, arguments[key] )
      	}
      
      	return DBObject.get();
      }
      

      When this function is called as a UDF, it works as expected. When installed as a BIF, the order of arguments apparently is not preserved. The resulting elements are in unpredictable order, much like normal structs.

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              sdaniels Sean Daniels
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: