Mac OS X's default PHP install does not include pcntl. Let's make this optional, so people don't have to recompile PHP just to use phpsh. This commit lets us use the benefits of pcntl if we have it, but doesn't force us to have it.
In order to avoid crashing phpsh on fatal errors, a trick was added that would fork PHP on every command. This trick relies on `__init__.py` to keep track of PIDs. Unfortunately, on some systems, namely Ubuntu, `subprocess.Popen()` reports an incorrect PID for the initial startup of `phpsh.php`. The reason for this has to do with the way that `subprocess.Popen()` executes commands. By default, commands are executed using the Bourne shell (or a Bourne shell replacement which is more likely the case) by issuing the following command: `/bin/sh -c command`. The problem with this is that some Bourne shell replacements handle this differently. For example, in bash this command will create a single process with a single PID. In dash (the default Bourne shell replacement for Ubuntu) this command will create two separate processes and report back to Python that the PID is actually for the `/bin/sh -c` command. To fix this inconsistency, we must force Python to use the same shell regardless of the operating system. I've chosen bash since it's the more ubiquitous Bourne shell replacement and also produces the more desirable results.
…g build directory or compiled python files.
Ignore stderr while checking if Xdebug is already loaded.
after inserting all of them, instead of insertion sorting.
…tead of a linear search.
…tions were raised while loading ctags. For instance, if you just run phpsh without creating a ctags file, autocomplete will not work. This shouldn't be the case as autocomplete doesn't require ctags.
… quotes. (like ["abc":protected])
Summary: Improve error output when there is a problem starting PHP.
Summary: python by default ignores SIGPIPE, this setting transfers to child processes, causing some php processes to not exit in certain cases and instead waste CPU. This resets the SIGPIPE signal handler to default, which will kill the process when the pipe is gone.
Summary: current implementation of phpsh usese serialize/unserialize cycle and some hacks to convert an object into an array. This fails if the object's class implements the Serializable interface and uses custom serialization (hacks dont' work). I have fixed this problem by instead casting objects to arrays and demangiling private and protected key names.
Summary: operator precedence is off so you get an exception about types dbgp-phpsh.py
Summary: it looks like the python installer will no longer leave dbgp.py executable, probably to enforce standards and stop ppl like us. so now we do the "right thing" and make dbgp.py an actual "script" in setup.py. also give it longer name dbgp-phpsh.py. Reviewed By: ccheever Test Plan: phpsh --version, fb redeploy, stuff in and out of www/, d Revert Plan: ok