Source for file register_globals.php

Documentation is available at register_globals.php

  1. <?php
  2. /**
  3. * Test Class for register_globals
  4. *
  5. * @package PhpSecInfo
  6. * @author Ed Finkler <coj@funkatron.com>
  7. */
  8.  
  9.  
  10. /**
  11. * require the PhpSecInfo_Test_Core class
  12. */
  13. require_once('PhpSecInfo/Test/Test_Core.php');
  14.  
  15.  
  16. /**
  17. * Test Class for register_globals
  18. *
  19. * @package PhpSecInfo
  20. */
  21. class PhpSecInfo_Test_Core_Register_Globals extends PhpSecInfo_Test_Core
  22. {
  23.  
  24. /**
  25. * This should be a <b>unique</b>, human-readable identifier for this test
  26. *
  27. * @var string
  28. */
  29. var $test_name = "register_globals";
  30.  
  31.  
  32. var $recommended_value = FALSE;
  33.  
  34.  
  35. function _retrieveCurrentValue() {
  36. $this->current_value = $this->getBooleanIniValue('register_globals');
  37. }
  38.  
  39.  
  40. /**
  41. * register_globals has been removed since PHP 6.0
  42. *
  43. * @return boolean
  44. */
  45. function isTestable() {
  46. return version_compare(PHP_VERSION, '6', '<') ;
  47. }
  48.  
  49.  
  50.  
  51. /**
  52. * Checks to see if allow_url_fopen is enabled
  53. *
  54. */
  55. function _execTest() {
  56. if ($this->current_value == $this->recommended_value) {
  57. return PHPSECINFO_TEST_RESULT_OK;
  58. }
  59.  
  60. return PHPSECINFO_TEST_RESULT_WARN;
  61. }
  62.  
  63.  
  64. /**
  65. * Set the messages specific to this test
  66. *
  67. */
  68. function _setMessages() {
  69. parent::_setMessages();
  70.  
  71. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'You are running PHP 6 or later and register_globals has been removed');
  72. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'register_globals is disabled, which is the recommended setting');
  73. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'register_globals is enabled. This could be a serious security risk. You should disable register_globals immediately');
  74. }
  75.  
  76.  
  77. }

Documentation generated on Mon, 26 Feb 2007 10:50:03 -0500 by phpDocumentor 1.3.0RC3