{"record":{"id":"3b7d570f7d1106c8","repo":"phacility/phabricator","slug":"unknown-dialog-width-s","errorCode":null,"errorMessage":"Unknown dialog width '%s'!","messagePattern":"Unknown dialog width '(.+?)'!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/view/AphrontDialogView.php","lineNumber":317,"sourceCode":"          __CLASS__));\n    }\n\n    $classes = array();\n    $classes[] = 'aphront-dialog-view';\n    $classes[] = $this->class;\n    if ($this->flush) {\n      $classes[] = 'aphront-dialog-flush';\n    }\n\n    switch ($this->width) {\n      case self::WIDTH_FORM:\n      case self::WIDTH_FULL:\n        $classes[] = 'aphront-dialog-view-width-'.$this->width;\n        break;\n      case self::WIDTH_DEFAULT:\n        break;\n      default:\n        throw new Exception(\n          pht(\n            \"Unknown dialog width '%s'!\",\n            $this->width));\n    }\n\n    if ($this->isStandalone) {\n      $classes[] = 'aphront-dialog-view-standalone';\n    }\n\n    if ($this->objectList) {\n      $classes[] = 'aphront-dialog-object-list';\n    }\n\n    $attributes = array(\n      'class'   => implode(' ', $classes),\n      'sigil'   => 'jx-dialog',\n      'role'    => 'dialog',\n    );","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/view/AphrontDialogView.php#L299-L335","documentation":"AphrontDialogView::setWidth() accepts only the class constants WIDTH_DEFAULT ('default'), WIDTH_FORM ('form'), and WIDTH_FULL ('full'), which map to predefined CSS width classes. render() validates the stored width with a switch and throws on any other value — there are no numeric or arbitrary widths; the layout is CSS-class driven.","triggerScenarios":"Calling setWidth() with anything other than 'default', 'form', or 'full' — e.g. setWidth('600px'), setWidth('wide'), setWidth(600), or passing an unvalidated user/config value straight into setWidth().","commonSituations":"Trying to set a pixel width from another UI framework's habits; feeding a width from a config file or request parameter without whitelisting; typos like 'Full' or 'form ' (case and whitespace matter).","solutions":["Use the class constants: setWidth(AphrontDialogView::WIDTH_FORM) or WIDTH_FULL; omit setWidth() for the default width.","If the value comes from config/user input, map it through a whitelist of the three constants and fall back to WIDTH_DEFAULT for anything else.","For custom widths you would need a custom dialog class — do not pass raw strings here."],"exampleFix":"// before\n$dialog->setWidth('600px');\n\n// after\n$dialog->setWidth(AphrontDialogView::WIDTH_FORM);","handlingStrategy":"type-guard","validationCode":"// Whitelist any dynamic width before handing it to the view:\n$valid = array(\n  AphrontDialogView::WIDTH_DEFAULT => true,\n  AphrontDialogView::WIDTH_FORM => true,\n  AphrontDialogView::WIDTH_FULL => true,\n);\n$width = isset($valid[$width]) ? $width : AphrontDialogView::WIDTH_DEFAULT;\n$dialog->setWidth($width);","typeGuard":"// Narrow to the three legal width constants:\nfunction is_valid_dialog_width($width) {\n  $valid = array(\n    AphrontDialogView::WIDTH_DEFAULT => true,\n    AphrontDialogView::WIDTH_FORM => true,\n    AphrontDialogView::WIDTH_FULL => true,\n  );\n  return isset($valid[$width]);\n}","tryCatchPattern":null,"preventionTips":["Always pass the WIDTH_* class constants, never string or pixel literals.","Never forward user input or config values into setWidth() without whitelisting against the constants.","Remember widths are CSS classes, not sizes — there is no numeric width to set."],"tags":["phabricator","ui","dialog","enum-validation","php"],"backgroundTag":"invalid-enum-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}