Page MenuHomePhabricator

Fatal AFPException when AbuseFilter rule has array index with undefined value
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:

Run:

[true][timestamp * 0]

at [[Special:AbuseFilter/test]]

(it looks like timestamp is set to undefined value in Special:AbuseFilter/test).

Or: evaluate

false & (a := 0);
[true][a]

in the expression evaluator.

Actual Results:

Internal Error

[Xb@VvgpAIDAAABg0VfcAAADA] 2019-11-04 03:06:38: การยกเว้นข้อผิดพลาดร้ายแรงของประเภท "AFPException"

(at thwiki)

and

    "error": {
        "code": "internal_api_error_AFPException",
        "info": "[Xb@1UQpAIDQAAKo@jBsAAACE] Caught exception of type AFPException",
        "errorclass": "AFPException"
    },
    "servedby": "mw1340"
}

Expected Results:

A proper error should be raised.

Event Timeline

Nullzero renamed this task from Internal error on array indexing to Internal error on array indexing with undefined value.Nov 4 2019, 5:21 AM
Nullzero updated the task description. (Show Details)

This can happen both when DUNDEFINED is used for retrieving data:

x := [true];
x[timestamp * 0]

and when setting it:

x := [true];
x[timestamp * 0] := 1

For the former, it seems pretty clear to me that we should just return a DUNDEFINED. As for the second, I believe we should delete the *whole* array and change it to DUNDEFINED.

Change 548315 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Handle DUNDEFINED in array offsets

https://gerrit.wikimedia.org/r/548315

Krinkle renamed this task from Internal error on array indexing with undefined value to Fatal AFPException when AbuseFilter rule has array index with undefined value.Nov 13 2020, 12:08 AM

Change 548315 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Handle DUNDEFINED in array offsets

https://gerrit.wikimedia.org/r/548315