Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit e95afd1

Browse files
author
epriestley
committed
Apply "pcre.*_limit" config options at startup in CLI environments
Summary: Ref T13100. Ref T13586. These options have been in production for a while and seem to consistently improve behavior, downgrading segfaults to runtime errors. Make them global options for all CLI environments. See next change for web enviornments. Test Plan: Ran `arc`. Maniphest Tasks: T13586, T13100 Differential Revision: https://secure.phabricator.com/D21566
1 parent 9d5802c commit e95afd1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

support/init/init-script.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ function __arcanist_init_script__() {
5656
// inspect "args", and this option generally obscures useful debugging
5757
// information without any benefit in the context of Phabricator.
5858
'zend.exception_ignore_args' => 0,
59+
60+
// See T13100. We'd like the regex engine to fail, rather than segfault,
61+
// if handed a pathological regular expression.
62+
'pcre.backtrack_limit' => 10000,
63+
'pcre.recusion_limit' => 10000,
64+
65+
// NOTE: Phabricator applies a similar set of startup options for Web
66+
// environments in "PhabricatorStartup". Changes here may also be
67+
// appropriate to apply there.
5968
);
6069

6170
foreach ($config_map as $config_key => $config_value) {
@@ -106,8 +115,6 @@ function __arcanist_init_script__() {
106115

107116
PhutilErrorHandler::initialize();
108117

109-
PhutilErrorHandler::initialize();
110-
111118
// If "variables_order" excludes "E", silently repair it so that $_ENV has
112119
// the values we expect.
113120
PhutilExecutionEnvironment::repairMissingVariablesOrder();

0 commit comments

Comments
 (0)