qooxdoo / qooxdoo

qooxdoo - Universal JavaScript Framework
http://qooxdoo.org
Other
765 stars 260 forks source link

The qx.util.Serializer.toJson fail on NaN integer #10712

Closed nwgroup closed 16 hours ago

nwgroup commented 1 month ago

When av value have an NaN value, the JSOn structure fails.

To Reproduce Steps to reproduce the behavior:

  1. Create an array with NaN value
goldim commented 1 month ago

@nwgroup Hello, could you describe the issue in more details please? What version of environment/qooxdoo/nodejs/etc do you use? Some code example also be wanted. What I've tried is:

const serer = qx.util.Serializer;
const res = serer.toJson([1, NaN]);
console.log(res);

qx v7.7.2 and there is no any errors. The output is fine.

nwgroup commented 16 hours ago

Well, finally we found the problem on an RPC call with NaN values. For that reason our fix was: ` toJson(object, qxSerializer, dateFormat) {

  var result = "";
  // null or undefined
  if (object == null) {
    return "null";
  }

  if (Number.isNaN(object)) {
    return "null";
  }` 

and the RPC call got fine. We don't know if is better to commit that change or only apply for us. Thanks for the help!