rfc-editor / rpcwebsite

Code base for RPC website
Other
4 stars 2 forks source link

errata_json_creator.php: incorrect handling of text that can be parsed as number #24

Closed reschke closed 1 year ago

reschke commented 2 years ago

See https://www.rfc-editor.org/errata/eid4232:

It should say:

+0000

The JSON export has (see 'correct_text'):

  {
    "errata_id": 4232,
    "doc-id": "RFC7231",
    "errata_status_code": "Rejected",
    "errata_type_code": "Technical",
    "section": "7.1.1.1",
    "orig_text": "GMT",
    "correct_text": 0,
    "notes": "The text refers to RFC 5322. There Sect 3.3 calls the use timezone abbreviations, like GMT, obsolete. It encourages using a numeric offset such as +0000.\r\n\r\nThe grammar for dates in 7231 Sect 7.1.1.1 uses GMT. Example dates throughout this RFC and others related to HTTP use GMT. This is inconsistent with 5322.\r\n\r\nThe RFCs for HTTP need to be modified to match 5322, or 7.1.1.1 needs a note that HTTP deliberately deviates from 5322 with regards to the timezone.\n --VERIFIER NOTES-- \nThe document is quite clear that the \"GMT\" version is preferred, and is necessary for compatibility with earlier versions and implementations.",
    "submit_date": "2015-01-14",
    "submitter_name": "Christopher Olson",
    "verifier_id": 130,
    "verifier_name": "Barry Leiba",
    "update_date": "2019-09-10 09:09:03"
  },

So apparently something is trying to parse the text as number, and if that succeeds, treats it as number.

jrlevine commented 2 years ago

Since we're planning to redo the whole RFC Editor web site in a year or so, I think this can wait for the redo. My guess is that it's PHP helpfully doing what PHP does and saying oh, look! a number!

reschke commented 2 years ago

There's a similar problem in that section numbers get treated as floats...

But isn't this caused by the mysql JSON export somehow?

jrlevine commented 2 years ago

No, it's the PHP json_encode() routine. We could ask her to take out the JSON_NUMERIC_CHECK flag which would stop trying to turn strings of digits into numbers but then the errata_id and verifier_id might be a string, too.

reschke commented 2 years ago

I would consider that a bugfix, but it's hard to say whether that would break something.

PriyankaGitCom commented 1 year ago

Removed JSON_NUMERIC_CHECK from json_encode.