Skip to content


fixes #3 for ubuntu 12.10 with PHP 5.4 #5

wants to merge 1 commit into from

2 participants


I just fixed a couple of things to make the code able to find the executable in the correct path - remember that the *nix operating systems are generally case-sensitive so "Path" vs "PATH" was causing the error on my platform.

Lisantra Technologies, LLC member

If I remember correctly, I commented out DIRECTORY_SEPARATOR because on Windows, Path might have already terminated in a slash. I'll re-run the tests with DIRECTORY_SEPARATOR back in on Windows and confirm or deny. I'll definitely merge the the first chunk: that's a real egregious oversight on my part. If all is well with the second chunk, I'll merge the who pull request as is.

Lisantra Technologies, LLC member

It seems the casing is different on different OS's:



Uppercasing it to "PATH" on Windows emits a PHP warning, that the index does not exist, and returns an empty value. Bummer. Now, I'm looking for an OS-independent way of grabbing the path, or even not using $_SERVER, but so far, no joy. I can just add a constant for it at the head of the file and test for OS as we do for the binary (and abstract that test out to a private function or statement in the constructor to set a class property as a flag). Suggestions?

This happens because $_SERVER['PATH'] is actually an operating system environment variable, not a PHP thing. I'm making a pull request which grabs this a few lines above when we're doing windows/*nix stuff separately anyway. We may need to revisit but I think it's good enough to be going on with!


Superceded by #8

@lornajane lornajane closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 3, 2013
  1. @lornajane
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 Trunk/VersionControl/Hg/Executable.php
6 Trunk/VersionControl/Hg/Executable.php
@@ -249,11 +249,11 @@ public function setExecutable($path = null)
if ( ( empty($executables) ) || ( null === $path ) ) {
/* iterate through the system's path to automagically find an
* executable */
- $paths = explode(PATH_SEPARATOR, $_SERVER['Path']);
+ $paths = explode(PATH_SEPARATOR, $_SERVER['PATH']);
foreach ( $paths as $path ) {
- if (is_executable($path . $binary)) { //DIRECTORY_SEPARATOR .
- $executables[] = $path . $binary;
+ if (is_executable($path . DIRECTORY_SEPARATOR . $binary)) { //DIRECTORY_SEPARATOR .
+ $executables[] = $path . DIRECTORY_SEPARATOR . $binary;
Something went wrong with that request. Please try again.