phpxmlrpc_verify_compat

Verify compatibility level of current php install with php-xmlrpc lib.

Description

phpxmlrpc_verify_compat( (string) $mode = 'client' ); 

Parameters (1)

0. $mode — Optional. (string) => 'client'
The mode.

Usage

  1. if ( !function_exists( 'phpxmlrpc_verify_compat' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7-infusionsoft-add-on/src/xmlrpc-3.0/test/verify_compat.php'; 
  3.  
  4. // The mode. 
  5. $mode = 'client'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = phpxmlrpc_verify_compat($mode); 
  9.  

Defined (1)

The function is defined in the following location(s).

/src/xmlrpc-3.0/test/verify_compat.php  
  1. function phpxmlrpc_verify_compat($mode='client') 
  2. $tests = array(); 
  3.  
  4. if ($mode == 'server') 
  5. // test for php version 
  6. $ver = phpversion(); 
  7. $tests['php_version'] = array(); 
  8. $tests['php_version']['description'] = 'PHP version found: '.$ver.".\n\n"; 
  9. if (version_compare($ver, '5') < 0) 
  10. $tests['php_version']['status'] = 0; 
  11. $tests['php_version']['description'] .= 'This version of PHP is not compatible with this release of the PHP XMLRPC library. Please upgrade to php 5 or later'; 
  12. else if (version_compare($ver, '5.0.3') < 0) 
  13. $tests['php_version']['status'] = 1; 
  14. $tests['php_version']['description'] .= "This version of PHP is almost completely compatible with the PHP XMLRPC library.\nThe only unavailable function is automatic mapping of php functions to xmlrpc methods"; 
  15. else 
  16. $tests['php_version']['status'] = 2; 
  17. $tests['php_version']['description'] .= 'This version of PHP is fully compatible with the PHP XMLRPC library'; 
  18.  
  19. // test for zlib 
  20. $tests['zlib'] = array(); 
  21. if (!function_exists('gzinflate')) 
  22. $tests['zlib']['status'] = 0; 
  23. $tests['zlib']['description'] = "The zlib extension is not enabled.\n\nYou will not be able to receive compressedrequestsor send compressed responses, unless using the cURL library (for 'HTTPS' and 'HTTP 1.1' connections)"; 
  24. else 
  25. $tests['zlib']['status'] = 2; 
  26. $tests['zlib']['description'] = "The zlib extension is enabled.\n\nYou will be able to receive compressedrequestsand send compressed responses for the 'HTTP' protocol"; 
  27.  
  28. // test for dispaly of php errors in xml reponse 
  29. if (ini_get('display_errors')) 
  30. if (intval(ini_get('error_reporting')) && E_NOTICE ) 
  31. $tests['display_errors']['status'] = 1; 
  32. $tests['display_errors']['description'] = "Error reporting level includes E_NOTICE errors, and display_errors is set to ON.\n\nAny error, warning or notice raised while executing php code exposed as xmlrpc method will result in an invalid xmlrpc response"; 
  33. else 
  34. $tests['display_errors']['status'] = 1; 
  35. $tests['display_errors']['description'] = "display_errors is set to ON.\n\nAnyerrorraised while executing php code exposed as xmlrpc method will result in an invalid xmlrpc response"; 
  36.  
  37. else 
  38.  
  39. // test for php version 
  40. $ver = phpversion(); 
  41. $tests['php_version'] = array(); 
  42. $tests['php_version']['description'] = 'PHP version found: '.$ver.".\n\n"; 
  43. if (version_compare($ver, '5') < 0) 
  44. $tests['php_version']['status'] = 0; 
  45. $tests['php_version']['description'] .= 'This version of PHP is not compatible with the PHP XMLRPC library. Please upgrade to 5.0 or later'; 
  46. else 
  47. $tests['php_version']['status'] = 2; 
  48. $tests['php_version']['description'] .= 'This version of PHP is fully compatible with the PHP XMLRPC library'; 
  49.  
  50. // test for zlib 
  51. $tests['zlib'] = array(); 
  52. if (!function_exists('gzinflate')) 
  53. $tests['zlib']['status'] = 0; 
  54. $tests['zlib']['description'] = "The zlib extension is not enabled.\n\nYou will not be able to send compressedrequestsor receive compressed responses, unless using the cURL library (for 'HTTPS' and 'HTTP 1.1' connections)"; 
  55. else 
  56. $tests['zlib']['status'] = 2; 
  57. $tests['zlib']['description'] = "The zlib extension is enabled.\n\nYou will be able to send compressedrequestsand receive compressed responses for the 'HTTP' protocol"; 
  58.  
  59. // test for CURL 
  60. $tests['curl'] = array(); 
  61. if (!extension_loaded('curl')) 
  62. $tests['curl']['status'] = 0; 
  63. $tests['curl']['description'] = "The cURL extension is not enabled.\n\nYou will not be able to send and receive messages using 'HTTPS' and 'HTTP 1.1' protocols"; 
  64. else 
  65. $info = curl_version(); 
  66. $tests['curl']['status'] = 2; 
  67. $tests['curl']['description'] = "The cURL extension is enabled.\n\nYou will be able to send and receive messages using 'HTTPS' and 'HTTP 1.1' protocols"; 
  68. if (version_compare($ver, '4.3.8') < 0) 
  69. $tests['curl']['status'] = 1; 
  70. $tests['curl']['description'] .= ".\nPlease note that the current cURL install does not support keep-alives"; 
  71. if (!((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version']))) 
  72. $tests['curl']['status'] = 1; 
  73. $tests['curl']['description'] .= ".\nPlease note that the current cURL install does not support compressed messages"; 
  74. if (!((is_string($info) && strpos($info, 'OpenSSL') !== null) || isset($info['ssl_version']))) 
  75. $tests['curl']['status'] = 1; 
  76. $tests['curl']['description'] .= ".\nPlease note that the current cURL install does not support HTTPS connections"; 
  77.  
  78. return $tests;