summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe <glen@delfi.ee>2013-09-11 15:32:21 +0300
committerBryan McLellan <btm@opscode.com>2013-11-25 11:32:31 -0800
commit0221aed83bbf765a1cb41a948f972428e61e8197 (patch)
tree2feddf5582fe67137f3cce87aece0c82d3a58492
parentbed2a6a69674e99abea5d79dc312592deecc577b (diff)
downloadohai-0221aed83bbf765a1cb41a948f972428e61e8197.tar.gz
[OHAI-509] fix build date parsing from php if php patched with suhosin:
$ php -v PHP 5.3.27 with Suhosin-Patch (cli) (built: Aug 30 2013 04:30:30) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies Conflicts: lib/ohai/plugins/php.rb
-rw-r--r--lib/ohai/plugins/php.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ohai/plugins/php.rb b/lib/ohai/plugins/php.rb
index 7489b52f..49d8cb74 100644
--- a/lib/ohai/plugins/php.rb
+++ b/lib/ohai/plugins/php.rb
@@ -28,10 +28,10 @@ Ohai.plugin(:PHP) do
so = shell_out("php -v")
if so.exitstatus == 0
- output = so.stdout.split
- if output.length >= 6
+ output = /PHP (\S+).+built: ([^)]+)/.match(so.stdout)
+ if output
php[:version] = output[1]
- php[:builddate] = "%s %s %s" % [output[4],output[5],output[6]]
+ php[:builddate] = output[2]
end
languages[:php] = php if php[:version]
end