Summary: We can use `php --run "echo phpversion();"` to return a nice, compact representation of the PHP version.
Test Plan: `arc unit`
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Differential Revision: https://secure.phabricator.com/D11264
}
public function getVersion() {
- list($stdout) = execx('%C --version', $this->getExecutableCommand());
-
- $matches = array();
- $regex = '/^PHP (?P<version>\d+\.\d+\.\d+)\b/';
- if (preg_match($regex, $stdout, $matches)) {
- return $matches['version'];
- } else {
- return false;
- }
+ list($stdout) = execx(
+ '%C --run %s',
+ $this->getExecutableCommand(),
+ 'echo phpversion();');
+ return $stdout;
}
public function shouldExpectCommandErrors() {