{"record":{"id":"80941cbb75d6c1d3","repo":"phacility/phabricator","slug":"unable-to-parse-argument-to-until","errorCode":null,"errorMessage":"Unable to parse argument to \"--until\".","messagePattern":"Unable to parse argument to \"--until\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/management/DrydockManagementLeaseWorkflow.php","lineNumber":58,"sourceCode":"          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $resource_type = $args->getArg('type');\n    if (!phutil_nonempty_string($resource_type)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify a resource type with \"--type\".'));\n    }\n\n    $until = $args->getArg('until');\n    if (phutil_nonempty_string($until)) {\n      $until = strtotime($until);\n      if ($until <= 0) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Unable to parse argument to \"--until\".'));\n      }\n    }\n\n    $count = $args->getArgAsInteger('count');\n    if ($count < 1) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Value provided to \"--count\" must be a nonzero, positive '.\n          'number.'));\n    }\n\n    $attributes_file = $args->getArg('attributes');\n    if (phutil_nonempty_string($attributes_file)) {\n      if ($attributes_file == '-') {\n        echo tsprintf(\n          \"%s\\n\",","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php#L40-L76","documentation":"A PhutilArgumentUsageException from `bin/drydock lease` when --until is given but strtotime() cannot parse it into a positive timestamp. PHP's strtotime() returns false for unparseable input, and false <= 0 is true, so both garbage strings and pre-epoch dates are rejected. The value must be anything strtotime understands, e.g. '2027-01-01' or '+2 hours'.","triggerScenarios":"`bin/drydock lease --type host --until 'not-a-date'` or a locale-specific format strtotime does not understand (e.g. '01/02/2027' parsed as US m/d/y when d/m/y was intended, or '2027-13-45').","commonSituations":"Date strings copied from other tools (ISO 8601 with timezone offsets usually works, exotic formats do not); scripts passing an empty-but-set variable after phutil_nonempty_string passes; human input like 'next thursday after lunch'.","solutions":["Use an unambiguous strtotime-compatible format: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS', '+2 hours', or a plain Unix timestamp string.","Test the value first: `php -r 'var_dump(strtotime($argv[1]));' -- \"<your string>\"` should print a positive integer.","In scripts, validate strtotime() !== false before invoking the CLI."],"exampleFix":"# before\nbin/drydock lease --type host --until '02/31/2027'\n\n# after\nbin/drydock lease --type host --until '2027-02-28 12:00:00'","handlingStrategy":"validation","validationCode":"$ts = strtotime($until);\nif ($ts === false || $ts <= 0) {\n  throw new InvalidArgumentException(\"Unparseable --until value: {$until}\");\n}\n// pass date('Y-m-d H:i:s', $ts) or the raw timestamp to the CLI","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize dates to 'YYYY-MM-DD HH:MM:SS' or a Unix timestamp before passing them to --until.","Remember strtotime() is the parser — when in doubt, test the string with `php -r 'echo strtotime(\"...\");'` first."],"tags":["drydock","phabricator","cli","date","strtotime","validation"],"backgroundTag":"invalid-date-format","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}