mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 08:12:40 +01:00
Make XHPAST parse-depth warning an actual warning.
Summary: XHPAST encounters a parse-depth problem on some files because PHP 5.2 has an un-overridable parse depth limit for JSON. The text of this error says it is a "warning" but we currently raise an error. Make it a warning instead. The JSON depth is 20 until PHP 5.2.3, where it becomes 128. After PHP 5.3 it defaults to 512 and is user-configurable, which will allow us to resolve this issue in nearly all cases. Since I made if/else express as a list in the AST, this only actually arises in long binary chains, most commonly string concatenation, like: $out = 'a'.'a'.'a'.'a'... ...where each string is a variable or HTML tag and the program is constructing a complicated document. At some point I'll add some PHP 5.3 massaging to the XHPAST decoder itself to raise this limit to something more huge. Test Plan: Ran "arc lint --lintall" on a file with a very deep binary expression tree ("1 + 1 + 1 ...") and received a warning instead of an error. Reviewed By: aran Reviewers: pad, aran CC: epriestley, aran Differential Revision: 54
This commit is contained in:
parent
61e16d9cc3
commit
4b30319747
1 changed files with 2 additions and 0 deletions
|
@ -79,6 +79,8 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
|
||||||
public function getLintSeverityMap() {
|
public function getLintSeverityMap() {
|
||||||
return array(
|
return array(
|
||||||
self::LINT_TODO_COMMENT => ArcanistLintSeverity::SEVERITY_ADVICE,
|
self::LINT_TODO_COMMENT => ArcanistLintSeverity::SEVERITY_ADVICE,
|
||||||
|
self::LINT_UNABLE_TO_PARSE
|
||||||
|
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
||||||
self::LINT_FORMATTING_CONVENTIONS
|
self::LINT_FORMATTING_CONVENTIONS
|
||||||
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
=> ArcanistLintSeverity::SEVERITY_WARNING,
|
||||||
self::LINT_NAMING_CONVENTIONS
|
self::LINT_NAMING_CONVENTIONS
|
||||||
|
|
Loading…
Reference in a new issue