{"record":{"id":"d884789d0934f773","repo":"phacility/phabricator","slug":"unable-to-parse-entry","errorCode":null,"errorMessage":"Unable to parse entry!","messagePattern":"Unable to parse entry!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php","lineNumber":691,"sourceCode":"    return $map;\n  }\n\n  private function parseRecursiveListFileData($file_path) {\n    $map   = array();\n    $mode  = 'xml';\n    $done  = false;\n    $entry = null;\n    foreach (new LinesOfALargeFile($file_path) as $lno => $line) {\n      switch ($mode) {\n        case 'entry':\n          if ($line == '</entry>') {\n            $entry = implode('', $entry);\n            $pattern = '@^\\s+kind=\"(file|dir)\">'.\n                       '<name>(.*?)</name>'.\n                       '(<size>(.*?)</size>)?@';\n            $matches = null;\n            if (!preg_match($pattern, $entry, $matches)) {\n              throw new Exception(pht('Unable to parse entry!'));\n            }\n            $map[html_entity_decode($matches[2])] =\n              $this->getFileTypeFromSVNKind($matches[1]);\n            $mode = 'entry-or-end';\n          } else {\n            $entry[] = $line;\n          }\n          break;\n        case 'entry-or-end':\n          if ($line == '</list>') {\n            $done = true;\n            break 2;\n          } else if ($line == '<entry') {\n            $mode = 'entry';\n            $entry = array();\n          } else {\n            throw new Exception(\n              pht(","sourceCodeStart":673,"sourceCodeEnd":709,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php#L673-L709","documentation":"The hand-rolled parser for svn ls --xml joins the lines of each <entry> element and matches a fixed regex expecting kind=\"(file|dir)\"><name>...</name> with an optional <size> block (PhabricatorRepositorySvnCommitChangeParserWorker.php:678-695). If the joined entry text does not match - different attribute order, extra attributes, CDATA or entity-heavy names - it throws 'Unable to parse entry!'.","triggerScenarios":"An svn client version emitting entries whose attribute order or content differs from the regex; names containing characters that break the lazy pattern; whitespace or formatting changes in the XML.","commonSituations":"Upgrading the svn binary or server changes the emitted XML shape; locale/encoding settings altering entity encoding of file names.","solutions":["Run the failing svn ls --xml command by hand and compare the entry text against the regex","Pin svn to a compatible version on the daemon host","Replace the regex parse with a real XML parser locally and report the incompatibility upstream"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate the entry shape with the production regex before relying on it:\n//   svn ls --xml <repo-url> | head -20\n// Entries must match kind=\"(file|dir)\"><name>...</name>[<size>...] exactly.","typeGuard":null,"tryCatchPattern":"try {\n  $map = $this->parseSVNListXML($file_path);\n} catch (Exception $ex) {\n  // Entry did not match the hardcoded regex: capture the raw XML for the\n  // report, pin/patch the svn client; retrying is pointless until then.\n  phlog(file_get_contents($file_path));\n  throw $ex;\n}","preventionTips":["Pin the svn client version and verify its ls --xml output after any upgrade","Avoid locale changes on daemon hosts that alter XML entity encoding","Keep the raw svn output in logs when parser errors occur, to diff expected vs actual formats"],"tags":["phabricator","svn","xml","parsing","regex","version-compatibility","php"],"backgroundTag":"vcs-output-parse-failure","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}