diff options
author | Kissaki <kissaki@gmx.de> | 2012-12-02 15:43:06 +0400 |
---|---|---|
committer | Kissaki <kissaki@gmx.de> | 2012-12-02 15:44:50 +0400 |
commit | 529f666f5bff7a9b51b82c09f0b0d85dd52dc413 (patch) | |
tree | 55cd294215eeb3a75724b1e92dbe823793a58c5a /scripts | |
parent | 80bed604c306b296b6488a65047a2a2d3f78bb4b (diff) |
add version and fn existence checks to the PHP sample scripts
for descriptive fatal errors
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/icedemo.php | 7 | ||||
-rw-r--r-- | scripts/idle.php | 8 | ||||
-rw-r--r-- | scripts/simpleregister.php | 8 | ||||
-rw-r--r-- | scripts/weblist.php | 6 |
4 files changed, 29 insertions, 0 deletions
diff --git a/scripts/icedemo.php b/scripts/icedemo.php index 2c59ea5e2..a19c3f3fc 100644 --- a/scripts/icedemo.php +++ b/scripts/icedemo.php @@ -8,6 +8,13 @@ <body> <?php +if (!extension_loaded('ice')) { + exit('Error: This example script needs the PHP extension for Ice to be loaded.'); +} +if ((!function_exists('Ice_intVersion') || Ice_intVersion() < 30400) || !function_exists('Ice_loadProfile')) { + exit('Error: This example script is compatible only for php-ice versions prior to 3.4.'); +} + Ice_loadProfile(); if ($argc > 0) { diff --git a/scripts/idle.php b/scripts/idle.php index 4a28fa5b5..64ec27372 100644 --- a/scripts/idle.php +++ b/scripts/idle.php @@ -52,6 +52,14 @@ $ice = 'Meta:tcp -h 127.0.0.1 -p 6502'; $mid = 0; ###################################################################### + +if (!extension_loaded('ice')) { + exit('Error: This example script needs the PHP extension for Ice to be loaded.'); +} +if ((!function_exists('Ice_intVersion') || Ice_intVersion() < 30400) || !function_exists('Ice_loadProfile')) { + exit('Error: This example script is compatible only for php-ice versions prior to 3.4.'); +} + Ice_loadProfile(); $base = $ICE->stringToProxy($ice); $murmur = $base->ice_checkedCast('::Murmur::Meta'); diff --git a/scripts/simpleregister.php b/scripts/simpleregister.php index 75f2e204c..5712efc38 100644 --- a/scripts/simpleregister.php +++ b/scripts/simpleregister.php @@ -11,6 +11,14 @@ $serverId = 1; // This is as simple as it can get. You really SHOULD NOT make the URL to this script all-public as it may be abused/spammed. + +if (!extension_loaded('ice')) { + exit('Error: This example script needs the PHP extension for Ice to be loaded.'); +} +if ((!function_exists('Ice_intVersion') || Ice_intVersion() < 30400) || !function_exists('Ice_loadProfile')) { + exit('Error: This example script is compatible only for php-ice versions prior to 3.4.'); +} + ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> diff --git a/scripts/weblist.php b/scripts/weblist.php index 62146970f..3f7f5cbdd 100644 --- a/scripts/weblist.php +++ b/scripts/weblist.php @@ -12,6 +12,12 @@ # if (Ice_intversion() >= 30400) { + if (!stream_resolve_include_path('Ice.php')) { + exit('The required file Ice.php could not be found in the PHP include path(s).'); + } + if (!stream_resolve_include_path('Murmur.php')) { + exit('The required file Murmur.php could not be found in the PHP include path(s).'); + } require 'Ice.php'; require 'Murmur.php'; } else { |