]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Change order of include_path
authorNick Harper <nharper@fb.com>
Fri, 25 May 2012 17:08:28 +0000 (10:08 -0700)
committerNick Harper <nharper@fb.com>
Fri, 25 May 2012 17:08:28 +0000 (10:08 -0700)
Summary:
With the current order of the include_path (checking in the parent dir of
arcanist last), it is possible to load the wrong libphutil which can have
bad side effects. Instead, the first place we check in include_path should
be the parent dir of arcanist.

(The issue I ran into is that I had a checkout of libphutil in my homedir,
and I was running arc from my homedir with --load-phutil-library to load
the libraries, and since ./ is the default value for include_path, we were
loading libphutil from my homedir instead of from alongside the copy of arc
that I was running. The libphutil alongside that copy of arc worked, but my
checkout of libphutil had D2545 in it, so it was broken.)

Test Plan:
ran arc (not in my homedir) with a broken libphutil in my homedir in my homedir
and it worked (before this change it didn't)

Reviewers: jungejason, vrana, epriestley

Reviewed By: vrana

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2576

scripts/__init_script__.php

index 35495d9133ba870dd8d0f4f9b4a3b1418a0b03ff..c099d526be03e7214082fc0e664e398b36469a9b 100644 (file)
@@ -20,7 +20,7 @@ $include_path = ini_get('include_path');
 
 $parent_dir = dirname(dirname(dirname(__FILE__)));
 
-ini_set('include_path', $include_path.PATH_SEPARATOR.$parent_dir);
+ini_set('include_path', $parent_dir.PATH_SEPARATOR.$include_path);
 @include_once 'libphutil/scripts/__init_script__.php';
 if (!@constant('__LIBPHUTIL__')) {
   echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to ".