Page MenuHomePhabricator

Undefined variable: content in ApiVisualEditor
Closed, ResolvedPublic1 Story Points

Description

Spotted in production:

Notice: Undefined variable: content in /srv/mediawiki/php-1.30.0-wmf.19/extensions/VisualEditor/ApiVisualEditor.php on line 571

Full logstash entry:

{
  "_index": "logstash-2017.09.21",
  "_type": "hhvm",
  "_id": "AV6mCpUUTqnoMLVn50n3",
  "_score": null,
  "_source": {
    "severity": 3,
    "level": "NOTICE",
    "program": "hhvm",
    "message": "Notice: Undefined variable: content in /srv/mediawiki/php-1.30.0-wmf.19/extensions/VisualEditor/ApiVisualEditor.php on line 571",
    "type": "hhvm",
    "priority": 11,
    "logsource": "mw1290",
    "normalized_message": "Notice: Undefined variable: content in /srv/mediawiki/php-1.30.0-wmf.19/extensions/VisualEditor/ApiVisualEditor.php on line 571",
    "tags": [
      "syslog",
      "es",
      "normalized_message_untrimmed"
    ],
    "@timestamp": "2017-09-21T20:04:24.000Z",
    "@version": "1",
    "host": "mw1290",
    "facility": 1,
    "severity_label": "Error",
    "timestamp": "Sep 21 20:04:24",
    "facility_label": "user-level"
  },
  "fields": {
    "@timestamp": [
      1506024264000
    ]
  },
  "sort": [
    1506024264000
  ]
}

Event Timeline

demon created this task.Sep 21 2017, 8:53 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 21 2017, 8:53 PM

Looks like a regression from the preload patch. Pinging @DLynch

DLynch added a comment.EditedSep 21 2017, 9:19 PM

Looks like I missed a path through the function. This is happening when a page that already exists is loaded with a preload parameter. Which does nothing, but it expects there to be content because preload was provided.

Change 379666 had a related patch set uploaded (by DLynch; owner: DLynch):
[mediawiki/extensions/VisualEditor@master] ApiVisualEditor: Stop an undefined variable error for preload on existing pages

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

Change 379666 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ApiVisualEditor: Stop an undefined variable error for preload on existing pages

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

Change 379671 had a related patch set uploaded (by Jforrester; owner: DLynch):
[mediawiki/extensions/VisualEditor@wmf/1.30.0-wmf.19] ApiVisualEditor: Stop an undefined variable error for preload on existing pages

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

Change 379671 abandoned by Jforrester:
ApiVisualEditor: Stop an undefined variable error for preload on existing pages

Reason:
Not worth back-porting just for a day.

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

Jdforrester-WMF closed this task as Resolved.Sep 26 2017, 3:02 PM
Jdforrester-WMF assigned this task to DLynch.
Jdforrester-WMF set the point value for this task to 1.
Jdforrester-WMF moved this task from To Triage to TR0: Interrupt on the VisualEditor board.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptSep 26 2017, 3:02 PM
Nikerabbit reopened this task as Open.Oct 4 2017, 2:01 PM
Nikerabbit added a subscriber: Nikerabbit.

This is still happening, on line 584 now (( $params['preload'] && $content ). isset() is needed to check for undefined variables.

https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2017.10.04/hhvm?id=AV7noakYTqnoMLVnA-P3&_g=h@d9ca1ec

Change 382166 had a related patch set uploaded (by DLynch; owner: DLynch):
[mediawiki/extensions/VisualEditor@master] ApiVisualEditor: avoid some unset variable notices

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

Change 382166 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ApiVisualEditor: avoid some unset variable notices

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

Deskana closed this task as Resolved.Oct 17 2017, 5:08 PM
Deskana added a subscriber: Deskana.

I guess the follow-up fixed this.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM