<?php declare (strict_types=1); function testString($a) : string { return $a; } var_dump(testString(1)); var_dump(testString(2.5)); var_dump(testString("compassites")); var_dump(testString([1, 2, 3]));
function assignVariables() { $settings = array('info' => array(), 'required' => array(), 'recommended' => array()); $safe_mode = ini_get('safe_mode'); $open_basedir = ini_get('open_basedir'); /* * Info Settings */ $settings['info']['server_software'] = $_SERVER['SERVER_SOFTWARE']; $settings['info']['server_api'] = PHP_SAPI; $settings['info']['server_os'] = PHP_OS . ' ' . php_uname('r') . ' ' . ilang('on') . ' ' . php_uname('m'); if (extension_loaded_or('apache2handler')) { $settings['info']['mod_security'] = getApacheModules('mod_security') ? ilang('on') : ilang('off'); } /* * Required Settings */ list($minimum, $recommended) = getTestValues('php_version'); $settings['recommended'][] = testIntegerMask(0, ilang('test_error_estrict'), 'error_reporting', E_STRICT, ilang('test_estrict_failed'), true, true, false); if (defined('E_DEPRECATED')) { $settings['recommended'][] = testIntegerMask(0, ilang('test_error_edeprecated'), 'error_reporting', E_DEPRECATED, ilang('test_edeprecated_failed'), true, true, false); } $settings['required'][] = testVersionRange(1, ilang('test_check_php', $minimum) . '<br />' . ilang('test_min_recommend', $minimum, $recommended), phpversion(), ilang('test_requires_php_version', phpversion(), $recommended), $minimum, $recommended, false); $settings['required'][] = testBoolean(1, ilang('test_check_md5_func'), function_exists('md5'), '', false, false, 'Function_md5_disabled'); list($minimum, $recommended) = getTestValues('gd_version'); $settings['required'][] = testGDVersion(1, ilang('test_check_gd'), $minimum, ilang('test_check_gd_failed'), 'min_GD_version'); $settings['required'][] = testFileWritable(1, ilang('test_check_write') . ' config.php', CONFIG_FILE_LOCATION, ilang('test_may_not_exist'), $this->debug); $settings['required'][] = testBoolean(1, ilang('test_check_tempnam'), function_exists('tempnam'), '', false, false, 'Function_tempnam_disabled'); $settings['required'][] = testBoolean(1, ilang('test_check_magic_quotes_runtime'), 'magic_quotes_runtime', ilang('test_check_magic_quotes_runtime_failed'), true, true, 'magic_quotes_runtime_On'); $settings['required'][] = testSupportedDatabase(1, ilang('test_check_db_drivers'), false, ilang('test_check_db_drivers_failed')); if ('1' != $safe_mode && !isset($_SESSION['allowsafemode'])) { $settings['required'][] = testCreateDirAndFile(1, ilang('test_create_dir_and_file'), ilang('info_create_dir_and_file'), $this->debug); } /* * Recommended Settings */ list($minimum, $recommended) = getTestValues('memory_limit'); $settings['recommended'][] = testRange(0, ilang('test_check_memory') . '<br />' . ilang('test_min_recommend', $minimum, $recommended), 'memory_limit', ilang('test_check_memory_failed'), $minimum, $recommended, true, true, null, 'memory_limit_range'); list($minimum, $recommended) = getTestValues('max_execution_time'); $settings['recommended'][] = testRange(0, ilang('test_check_time_limit') . '<br />' . ilang('test_min_recommend', $minimum, $recommended), 'max_execution_time', ilang('test_check_time_limit_failed'), $minimum, $recommended, true, false, 0, 'max_execution_time_range'); $settings['recommended'][] = testBoolean(0, ilang('test_check_register_globals'), 'register_globals', ilang('test_check_register_globals_failed'), true, true, 'register_globals_enabled'); $settings['recommended'][] = testInteger(0, ilang('test_check_output_buffering'), 'output_buffering', ilang('test_check_output_buffering_failed'), true, true, 'output_buffering_disabled'); $settings['recommended'][] = testString(0, ilang('test_check_disable_functions'), 'disable_functions', ilang('test_check_disable_functions_failed'), true, 'green', 'yellow', 'disable_functions_not_empty'); if (!isset($_SESSION['allowsafemode'])) { $settings['recommended'][] = testBoolean(0, ilang('test_check_safe_mode'), 'safe_mode', ilang('test_check_safe_mode_failed'), true, true, 'safe_mode_enabled'); } $settings['recommended'][] = testString(0, ilang('test_check_open_basedir'), $open_basedir, ilang('test_check_open_basedir_failed'), false, 'green', 'yellow', 'open_basedir_enabled'); if (!isset($_SESSION['skipremote'])) { $settings['recommended'][] = testRemoteFile(0, ilang('test_remote_url'), '', ilang('test_remote_url_failed'), $this->debug); } $settings['recommended'][] = testBoolean(0, ilang('test_check_file_upload'), 'file_uploads', ilang('test_check_file_failed'), true, false, 'Function_file_uploads_disabled'); list($minimum, $recommended) = getTestValues('post_max_size'); $settings['recommended'][] = testRange(0, ilang('test_check_post_max') . '<br />' . ilang('test_min_recommend', $minimum, $recommended), 'post_max_size', ilang('test_check_post_max_failed'), $minimum, $recommended, true, true, null, 'min_post_max_size'); list($minimum, $recommended) = getTestValues('upload_max_filesize'); $settings['recommended'][] = testRange(0, ilang('test_check_upload_max') . '<br />' . ilang('test_min_recommend', $minimum, $recommended), 'upload_max_filesize', ilang('test_check_upload_max_failed'), $minimum, $recommended, true, true, null, 'min_upload_max_filesize'); $f = cms_join_path(CMS_BASE, 'uploads'); $settings['recommended'][] = testDirWrite(0, ilang('test_check_writable', $f), $f, ilang('test_check_upload_failed'), 0, $this->debug); $f = cms_join_path(CMS_BASE, 'uploads' . DIRECTORY_SEPARATOR . 'images'); $settings['recommended'][] = testDirWrite(0, ilang('test_check_writable', $f), $f, ilang('test_check_images_failed'), 0, $this->debug); $f = cms_join_path(CMS_BASE, 'modules'); $settings['recommended'][] = testDirWrite(0, ilang('test_check_writable', $f), $f, ilang('test_check_modules_failed'), 0, $this->debug); $session_save_path = testSessionSavePath(''); if (empty($session_save_path)) { $settings['recommended'][] = testDummy(ilang('test_check_session_save_path'), '', 'yellow', ilang('test_empty_session_save_path'), 'session_save_path_empty', ''); } elseif (!empty($open_basedir)) { $settings['recommended'][] = testDummy(ilang('test_check_session_save_path'), '', 'yellow', ilang('test_open_basedir_session_save_path'), 'No_check_session_save_path_with_open_basedir', ''); } else { $settings['recommended'][] = testDirWrite(0, ilang('test_check_session_save_path'), $session_save_path, ilang('test_check_session_save_path_failed', $session_save_path), 1, $this->debug); } $settings['recommended'][] = testBoolean(0, 'session.use_cookies', 'session.use_cookies', ilang('session_use_cookies')); $settings['recommended'][] = testBoolean(0, ilang('test_check_xml_func'), extension_loaded_or('xml'), ilang('test_check_xml_failed'), false, false, 'Function_xml_disabled'); $settings['recommended'][] = testBoolean(0, ilang('test_xmlreader_class'), class_exists('XMLReader', false), ilang('test_xmlreader_failed'), false, false, 'class_xmlreader_unavailable'); $settings['recommended'][] = testBoolean(0, ilang('test_check_file_get_contents'), function_exists('file_get_contents'), ilang('test_check_file_get_contents_failed'), false, false, 'Function_file_get_content_disabled'); # $settings['recommended'][] = # testBoolean(0, ilang('test_check_magic_quotes_gpc'), # 'magic_quotes_gpc', ilang('test_check_magic_quotes_gpc_failed'), true, true, 'magic_quotes_gpc_On'); $_log_errors_max_len = ini_get('log_errors_max_len') ? ini_get('log_errors_max_len') . '0' : '99'; ini_set('log_errors_max_len', $_log_errors_max_len); $result = ini_get('log_errors_max_len') == $_log_errors_max_len; $settings['recommended'][] = testBoolean(0, ilang('test_check_ini_set'), $result, ilang('test_check_ini_set_failed'), false, false, 'ini_set_disabled'); // assign settings list($this->continueon, $this->special_failed) = testGlobal(array(true, false), true); $this->smarty->assign('settings', $settings); $this->smarty->assign('special_failed', $this->special_failed); if (isset($_SESSION['advanceduser'])) { $this->smarty->assign('continueon', true); } else { $this->smarty->assign('continueon', $this->continueon); } $this->smarty->assign('phpinfo', getEmbedPhpInfo(INFO_CONFIGURATION | INFO_MODULES)); $this->smarty->assign('errors', $this->errors); }
} $tmp[1]['create_dir_and_file'] = testCreateDirAndFile(0, '', ''); list($minimum, $recommended) = getTestValues('memory_limit'); $tmp[0]['memory_limit'] = testRange(0, 'memory_limit', 'memory_limit', '', $minimum, $recommended, true, true, -1, 'memory_limit_range'); list($minimum, $recommended) = getTestValues('max_execution_time'); $tmp[0]['max_execution_time'] = testRange(0, 'max_execution_time', 'max_execution_time', '', $minimum, $recommended, true, false, 0, 'max_execution_time_range'); $tmp[1]['register_globals'] = testBoolean(0, lang('register_globals'), 'register_globals', '', true, true, 'register_globals_enabled'); $ob = ini_get('output_buffering'); if (strtolower($ob) == 'off' || strtolower($ob) == 'on') { $tmp[0]['output_buffering'] = testBoolean(0, lang('output_buffering'), 'output_buffering', '', true, false, 'output_buffering_disabled'); } else { $tmp[0]['output_buffering'] = testInteger(0, lang('output_buffering'), 'output_buffering', '', true, true, 'output_buffering_disabled'); } $tmp[1]['disable_functions'] = testString(0, lang('disable_functions'), 'disable_functions', '', true, 'green', 'yellow', 'disable_functions_not_empty'); $tmp[0]['safe_mode'] = testBoolean(0, 'safe_mode', 'safe_mode', '', true, true, 'safe_mode_enabled'); $tmp[1]['open_basedir'] = testString(0, lang('open_basedir'), $open_basedir, '', false, 'green', 'yellow', 'open_basedir_enabled'); $tmp[1]['test_remote_url'] = testRemoteFile(0, 'test_remote_url', '', lang('test_remote_url_failed')); $tmp[0]['file_uploads'] = testBoolean(0, 'file_uploads', 'file_uploads', '', true, false, 'Function_file_uploads_disabled'); list($minimum, $recommended) = getTestValues('post_max_size'); $tmp[0]['post_max_size'] = testRange(0, 'post_max_size', 'post_max_size', '', $minimum, $recommended, true, true, null, 'min_post_max_size'); list($minimum, $recommended) = getTestValues('upload_max_filesize'); $tmp[0]['upload_max_filesize'] = testRange(0, 'upload_max_filesize', 'upload_max_filesize', '', $minimum, $recommended, true, true, null, 'min_upload_max_filesize'); $session_save_path = testSessionSavePath(''); if (empty($session_save_path)) { $tmp[0]['session_save_path'] = testDummy('session_save_path', lang('os_session_save_path'), 'yellow', '', 'session_save_path_empty', ''); } elseif (!empty($open_basedir)) { $tmp[0]['session_save_path'] = testDummy('session_save_path', lang('open_basedir_active'), 'yellow', '', 'No_check_session_save_path_with_open_basedir', ''); } else { $tmp[0]['session_save_path'] = testDirWrite(0, lang('session_save_path'), $session_save_path, $session_save_path, 1); } $tmp[0]['session_use_cookies'] = testBoolean(0, 'session.use_cookies', 'session.use_cookies');