TYPO3 CMS  TYPO3_6-2
Check.php
Go to the documentation of this file.
1 <?php
3 
18 
49 class Check {
50 
54  protected $requiredPhpExtensions = array(
55  'fileinfo',
56  'filter',
57  'gd',
58  'hash',
59  'json',
60  'mysqli',
61  'openssl',
62  'pcre',
63  'session',
64  'soap',
65  'SPL',
66  'standard',
67  'xml',
68  'zip',
69  'zlib',
70  );
71 
77  public function getStatus() {
78  $statusArray = array();
79  $statusArray[] = $this->checkCurrentDirectoryIsInIncludePath();
80  $statusArray[] = $this->checkFileUploadEnabled();
81  $statusArray[] = $this->checkMaximumFileUploadSize();
83  $statusArray[] = $this->checkMemorySettings();
84  $statusArray[] = $this->checkPhpVersion();
85  $statusArray[] = $this->checkMaxExecutionTime();
86  $statusArray[] = $this->checkDisableFunctions();
87  $statusArray[] = $this->checkDownloadsPossible();
88  $statusArray[] = $this->checkSafeMode();
89  $statusArray[] = $this->checkMysqliReconnectSetting();
90  $statusArray[] = $this->checkDocRoot();
91  $statusArray[] = $this->checkOpenBaseDir();
92  $statusArray[] = $this->checkXdebugMaxNestingLevel();
93  $statusArray[] = $this->checkOpenSslInstalled();
94  if ($this->isSuhosinLoadedAndActive()) {
95  $statusArray[] = $this->getSuhosinLoadedStatus();
96  $statusArray[] = $this->checkSuhosinRequestMaxVars();
97  $statusArray[] = $this->checkSuhosinRequestMaxVarnameLength();
98  $statusArray[] = $this->checkSuhosinPostMaxNameLength();
99  $statusArray[] = $this->checkSuhosinPostMaxVars();
100  $statusArray[] = $this->checkSuhosinGetMaxNameLength();
101  $statusArray[] = $this->checkSuhosinGetMaxValueLength();
102  $statusArray[] = $this->checkSuhosinExecutorIncludeWhitelistContainsPhar();
103  $statusArray[] = $this->checkSuhosinExecutorIncludeWhitelistContainsVfs();
104  }
105  $statusArray[] = $this->checkSomePhpOpcodeCacheIsLoaded();
106  $statusArray[] = $this->checkReflectionDocComment();
107  $statusArray[] = $this->checkSystemLocale();
108  $statusArray[] = $this->checkLocaleWithUTF8filesystem();
109  $statusArray[] = $this->checkWindowsApacheThreadStackSize();
110  foreach ($this->requiredPhpExtensions as $extension) {
111  $statusArray[] = $this->checkRequiredPhpExtension($extension);
112  }
113  $statusArray[] = $this->checkGdLibTrueColorSupport();
114  $statusArray[] = $this->checkGdLibGifSupport();
115  $statusArray[] = $this->checkGdLibJpgSupport();
116  $statusArray[] = $this->checkGdLibPngSupport();
117  $statusArray[] = $this->checkGdLibFreeTypeSupport();
118  $statusArray[] = $this->checkPhpMagicQuotes();
119  $statusArray[] = $this->checkRegisterGlobals();
120  $statusArray[] = $this->checkLibXmlBug();
121  $statusArray[] = $this->isTrueTypeFontDpiStandard();
122  return $statusArray;
123  }
124 
131  $includePath = ini_get('include_path');
132  $delimiter = $this->isWindowsOs() ? ';' : ':';
133  $pathArray = $this->trimExplode($delimiter, $includePath);
134  if (!in_array('.', $pathArray)) {
135  $status = new Status\WarningStatus();
136  $status->setTitle('Current directory (./) is not within PHP include path');
137  $status->setMessage(
138  'include_path = ' . implode(' ', $pathArray) . LF .
139  'Normally the current path \'.\' is included in the' .
140  ' include_path of PHP. Although TYPO3 does not rely on this,' .
141  ' it is an unusual setting that may introduce problems for' .
142  ' some extensions.'
143  );
144  } else {
145  $status = new Status\OkStatus();
146  $status->setTitle('Current directory (./) is within PHP include path.');
147  }
148  return $status;
149  }
150 
156  protected function checkFileUploadEnabled() {
157  if (!ini_get('file_uploads')) {
158  $status = new Status\ErrorStatus();
159  $status->setTitle('File uploads not allowed in PHP');
160  $status->setMessage(
161  'file_uploads=' . ini_get('file_uploads') . LF .
162  'TYPO3 uses the ability to upload files from the browser in various cases.' .
163  ' If this flag is disabled in PHP, you won\'t be able to upload files.' .
164  ' But it doesn\'t end here, because not only are files not accepted by' .
165  ' the server - ALL content in the forms are discarded and therefore' .
166  ' nothing at all will be editable if you don\'t set this flag!' .
167  ' However if you cannot enable fileupload for some reason in PHP, alternatively' .
168  ' change the default form encoding value with \\$TYPO3_CONF_VARS[SYS][form_enctype].'
169  );
170  } else {
171  $status = new Status\OkStatus();
172  $status->setTitle('File uploads allowed in PHP');
173  }
174  return $status;
175  }
176 
182  protected function checkMaximumFileUploadSize() {
183  $maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
184  $configuredMaximumUploadFilesize = 1024 * (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'];
185  if ($maximumUploadFilesize < $configuredMaximumUploadFilesize) {
186  $status = new Status\ErrorStatus();
187  $status->setTitle('PHP Maximum upload filesize too small');
188  $status->setMessage(
189  'PHP upload_max_filesize = ' . (int)($maximumUploadFilesize / 1024) . ' KB' . LF .
190  'TYPO3_CONF_VARS[BE][maxFileSize] = ' . (int)($configuredMaximumUploadFilesize / 1024) . ' KB' . LF . LF .
191  'Currently PHP determines the limits for uploaded file\'s sizes and not TYPO3.' .
192  ' It is recommended that the value of upload_max_filesize is at least equal to the value' .
193  ' of TYPO3_CONF_VARS[BE][maxFileSize].'
194  );
195  } else {
196  $status = new Status\OkStatus();
197  $status->setTitle('PHP Maximum file upload size is higher than or equal to [BE][maxFileSize]');
198  }
199  return $status;
200  }
201 
208  $maximumUploadFilesize = $this->getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
209  $maximumPostSize = $this->getBytesFromSizeMeasurement(ini_get('post_max_size'));
210  if ($maximumPostSize > 0 && $maximumPostSize < $maximumUploadFilesize) {
211  $status = new Status\ErrorStatus();
212  $status->setTitle('Maximum size for POST requests is smaller than maximum upload filesize in PHP');
213  $status->setMessage(
214  'upload_max_filesize=' . ini_get('upload_max_filesize') . LF .
215  'post_max_size=' . ini_get('post_max_size') . LF .
216  'You have defined a maximum size for file uploads in PHP which' .
217  ' exceeds the allowed size for POST requests. Therefore the' .
218  ' file uploads can also not be larger than ' . ini_get('post_max_size') . '.'
219  );
220  } else {
221  $status = new Status\OkStatus();
222  $status->setTitle('Maximum post upload size correlates with maximum upload file size in PHP');
223  }
224  return $status;
225  }
226 
232  protected function checkMemorySettings() {
233  $minimumMemoryLimit = 32;
234  $recommendedMemoryLimit = 64;
235  $memoryLimit = $this->getBytesFromSizeMeasurement(ini_get('memory_limit'));
236  if ($memoryLimit <= 0) {
237  $status = new Status\WarningStatus();
238  $status->setTitle('Unlimited memory limit for PHP');
239  $status->setMessage(
240  'PHP is configured not to limit memory usage at all. This is a risk' .
241  ' and should be avoided in production setup. In general it\'s best practice to limit this.' .
242  ' To be safe, set a limit in PHP, but with a minimum of ' . $recommendedMemoryLimit . 'MB:' . LF .
243  'memory_limit=' . $recommendedMemoryLimit . 'M'
244  );
245  } elseif ($memoryLimit < 1024 * 1024 * $minimumMemoryLimit) {
246  $status = new Status\ErrorStatus();
247  $status->setTitle('PHP Memory limit below ' . $minimumMemoryLimit . 'MB');
248  $status->setMessage(
249  'memory_limit=' . ini_get('memory_limit') . LF .
250  'Your system is configured to enforce a memory limit for PHP scripts lower than ' .
251  $minimumMemoryLimit . 'MB. It is required to raise the limit.' .
252  ' We recommend a minimum PHP memory limit of ' . $recommendedMemoryLimit . 'MB:' . LF .
253  'memory_limit=' . $recommendedMemoryLimit . 'M'
254  );
255  } elseif ($memoryLimit < 1024 * 1024 * $recommendedMemoryLimit) {
256  $status = new Status\WarningStatus();
257  $status->setTitle('PHP Memory limit below ' . $recommendedMemoryLimit . 'MB');
258  $status->setMessage(
259  'memory_limit=' . ini_get('memory_limit') . LF .
260  'Your system is configured to enforce a memory limit for PHP scripts lower than ' .
261  $recommendedMemoryLimit . 'MB.' .
262  ' A slim TYPO3 instance without many extensions will probably work, but you should monitor your' .
263  ' system for "allowed memory size of X bytes exhausted" messages, especially if using the backend.' .
264  ' To be on the safe side,' . ' we recommend a minimum PHP memory limit of ' .
265  $recommendedMemoryLimit . 'MB:' . LF .
266  'memory_limit=' . $recommendedMemoryLimit . 'M'
267  );
268  } else {
269  $status = new Status\OkStatus();
270  $status->setTitle('PHP Memory limit is equal to or more than ' . $recommendedMemoryLimit . 'MB');
271  }
272  return $status;
273  }
274 
280  protected function checkPhpVersion() {
281  $minimumPhpVersion = '5.3.7';
282  $currentPhpVersion = phpversion();
283  if (version_compare($currentPhpVersion, $minimumPhpVersion) < 0) {
284  $status = new Status\ErrorStatus();
285  $status->setTitle('PHP version too low');
286  $status->setMessage(
287  'Your PHP version ' . $currentPhpVersion . ' is too old. TYPO3 CMS does not run' .
288  ' with this version. Update to at least PHP ' . $minimumPhpVersion
289  );
290  } else {
291  $status = new Status\OkStatus();
292  $status->setTitle('PHP version is fine');
293  }
294  return $status;
295  }
296 
302  protected function checkMaxExecutionTime() {
303  $minimumMaximumExecutionTime = 30;
304  $recommendedMaximumExecutionTime = 240;
305  $currentMaximumExecutionTime = ini_get('max_execution_time');
306  if ($currentMaximumExecutionTime == 0) {
307  if (PHP_SAPI === 'cli') {
308  $status = new Status\OkStatus();
309  $status->setTitle('Infinite PHP script execution time');
310  $status->setMessage(
311  'Maximum PHP script execution time is always set to infinite (0) in cli mode.' .
312  ' The setting used for web requests cannot be checked from command line.'
313  );
314  } else {
315  $status = new Status\WarningStatus();
316  $status->setTitle('Infinite PHP script execution time');
317  $status->setMessage(
318  'max_execution_time=' . $currentMaximumExecutionTime . LF .
319  'While TYPO3 is fine with this, you risk a denial-of-service for your system if for whatever' .
320  ' reason some script hangs in an infinite loop. You are usually on the safe side ' .
321  ' if it is reduced to ' . $recommendedMaximumExecutionTime . ' seconds:' . LF .
322  'max_execution_time=' . $recommendedMaximumExecutionTime
323  );
324  }
325  } elseif ($currentMaximumExecutionTime < $minimumMaximumExecutionTime) {
326  $status = new Status\ErrorStatus();
327  $status->setTitle('Low PHP script execution time');
328  $status->setMessage(
329  'max_execution_time=' . $currentMaximumExecutionTime . LF .
330  'Your max_execution_time is too low. Some expensive operations in TYPO3 can take longer than that.' .
331  ' It is recommended to raise the limit to ' . $recommendedMaximumExecutionTime . ' seconds:' . LF .
332  'max_execution_time=' . $recommendedMaximumExecutionTime
333  );
334  } elseif ($currentMaximumExecutionTime < $recommendedMaximumExecutionTime) {
335  $status = new Status\WarningStatus();
336  $status->setTitle('Low PHP script execution time');
337  $status->setMessage(
338  'max_execution_time=' . $currentMaximumExecutionTime . LF .
339  'Your max_execution_time is low. While TYPO3 often runs without problems' .
340  ' with ' . $minimumMaximumExecutionTime . ' seconds,' .
341  ' it may still happen that script execution is stopped before finishing' .
342  ' calculations. You should monitor the system for messages in this area' .
343  ' and maybe raise the limit to ' . $recommendedMaximumExecutionTime . ' seconds:' . LF .
344  'max_execution_time=' . $recommendedMaximumExecutionTime
345  );
346  } else {
347  $status = new Status\OkStatus();
348  $status->setTitle('Maximum PHP script execution time is equal to or more than '
349  . $recommendedMaximumExecutionTime);
350  }
351  return $status;
352  }
353 
359  protected function checkDisableFunctions() {
360  $disabledFunctions = trim(ini_get('disable_functions'));
361 
362  // Filter "disable_functions"
363  $disabledFunctionsArray = $this->trimExplode(',', $disabledFunctions);
364 
365  // Array with strings to find
366  $findStrings = array(
367  // Disabled by default on Ubuntu OS but this is okay since the Core does not use them
368  'pcntl_',
369  );
370  foreach ($disabledFunctionsArray as $key => $disabledFunction) {
371  foreach ($findStrings as $findString) {
372  if (strpos($disabledFunction, $findString) !== FALSE) {
373  unset($disabledFunctionsArray[$key]);
374  }
375  }
376  }
377 
378  if (strlen($disabledFunctions) > 0 && count($disabledFunctionsArray) > 0) {
379  $status = new Status\ErrorStatus();
380  $status->setTitle('Some PHP functions disabled');
381  $status->setMessage(
382  'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF .
383  'These function(s) are disabled. TYPO3 uses some of those, so there might be trouble.' .
384  ' TYPO3 is designed to use the default set of PHP functions plus some common extensions.' .
385  ' Possibly these functions are disabled' .
386  ' due to security considerations and most likely the list would include a function like' .
387  ' exec() which is used by TYPO3 at various places. Depending on which exact functions' .
388  ' are disabled, some parts of the system may just break without further notice.'
389  );
390  } elseif (strlen($disabledFunctions) > 0 && count($disabledFunctionsArray) === 0) {
391  $status = new Status\NoticeStatus();
392  $status->setTitle('Some PHP functions currently disabled but OK');
393  $status->setMessage(
394  'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF .
395  'These function(s) are disabled. TYPO3 uses currently none of those, so you are good to go.'
396  );
397  } else {
398  $status = new Status\OkStatus();
399  $status->setTitle('No disabled PHP functions');
400  }
401  return $status;
402  }
403 
410  protected function checkDownloadsPossible() {
411  $allowUrlFopen = (bool)ini_get('allow_url_fopen');
412  $curlEnabled = !empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse']);
413  if ($allowUrlFopen || $curlEnabled) {
414  $status = new Status\OkStatus();
415  $status->setTitle('Fetching external URLs is allowed');
416  } else {
417  $status = new Status\WarningStatus();
418  $status->setTitle('Fetching external URLs is not allowed');
419  $status->setMessage(
420  'Either enable PHP runtime setting "allow_url_fopen"' . LF . 'or enable curl by setting [SYS][curlUse] accordingly.'
421  );
422  }
423  return $status;
424  }
425 
431  protected function checkMysqliReconnectSetting() {
432 
433  $currentMysqliReconnectSetting = ini_get('mysqli.reconnect');
434  if ($currentMysqliReconnectSetting === '1') {
435  $status = new Status\ErrorStatus();
436  $status->setTitle('PHP mysqli.reconnect is enabled');
437  $status->setMessage(
438  'mysqli.reconnect=1' . LF .
439  'PHP is configured to automatically reconnect the database connection on disconnection.' . LF .
440  ' Warning: If (e.g. during a long-running task) the connection is dropped and automatically reconnected, ' .
441  ' it may not be reinitialized properly (e.g. charset) and write mangled data to the database!'
442  );
443  } else {
444  $status = new Status\OkStatus();
445  $status->setTitle('PHP mysqli.reconnect is fine');
446  }
447  return $status;
448  }
449 
455  protected function checkSafeMode() {
456  $safeModeEnabled = FALSE;
457  if (version_compare(phpversion(), '5.4', '<')) {
458  $safeModeEnabled = filter_var(
459  ini_get('safe_mode'),
460  FILTER_VALIDATE_BOOLEAN,
461  array(FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE)
462  );
463  }
464  if ($safeModeEnabled) {
465  $status = new Status\ErrorStatus();
466  $status->setTitle('PHP safe mode on');
467  $status->setMessage(
468  'PHP safe_mode enabled. This is unsupported by TYPO3 CMS, it must be turned off:' . LF .
469  'safe_mode=Off'
470  );
471  } else {
472  $status = new Status\OkStatus();
473  $status->setTitle('PHP safe mode off');
474  }
475  return $status;
476  }
477 
483  protected function checkDocRoot() {
484  $docRootSetting = trim(ini_get('doc_root'));
485  if (strlen($docRootSetting) > 0) {
486  $status = new Status\NoticeStatus();
487  $status->setTitle('doc_root is set');
488  $status->setMessage(
489  'doc_root=' . $docRootSetting . LF .
490  'PHP cannot execute scripts' .
491  ' outside this directory. This setting is seldom used and must correlate' .
492  ' with your actual document root. You might be in trouble if your' .
493  ' TYPO3 CMS core code is linked to some different location.' .
494  ' If that is a problem, the setting must be changed.'
495  );
496  } else {
497  $status = new Status\OkStatus();
498  $status->setTitle('PHP doc_root is not set');
499  }
500  return $status;
501  }
502 
508  protected function checkOpenBaseDir() {
509  $openBaseDirSetting = trim(ini_get('open_basedir'));
510  if (strlen($openBaseDirSetting) > 0) {
511  $status = new Status\NoticeStatus();
512  $status->setTitle('PHP open_basedir is set');
513  $status->setMessage(
514  'open_basedir = ' . ini_get('open_basedir') . LF .
515  'This restricts TYPO3 to open and include files only in this' .
516  ' path. Please make sure that this does not prevent TYPO3 from running,' .
517  ' if for example your TYPO3 CMS core is linked to a different directory' .
518  ' not included in this path.'
519  );
520  } else {
521  $status = new Status\OkStatus();
522  $status->setTitle('PHP open_basedir is off');
523  }
524  return $status;
525  }
526 
532  protected function checkXdebugMaxNestingLevel() {
533  if (extension_loaded('xdebug')) {
534  $recommendedMaxNestingLevel = 400;
535  $errorThreshold = 250;
536  $currentMaxNestingLevel = ini_get('xdebug.max_nesting_level');
537  if ($currentMaxNestingLevel < $errorThreshold) {
538  $status = new Status\ErrorStatus();
539  $status->setTitle('PHP xdebug.max_nesting_level is critically low');
540  $status->setMessage(
541  'xdebug.max_nesting_level=' . $currentMaxNestingLevel . LF .
542  'This setting controls the maximum number of nested function calls to protect against' .
543  ' infinite recursion. The current value is too low for TYPO3 CMS and must' .
544  ' be either raised or xdebug has to be unloaded. A value of ' . $recommendedMaxNestingLevel .
545  ' is recommended. Warning: Expect fatal PHP errors in central parts of the CMS' .
546  ' if the value is not raised significantly to:' . LF .
547  'xdebug.max_nesting_level=' . $recommendedMaxNestingLevel
548  );
549  } elseif ($currentMaxNestingLevel < $recommendedMaxNestingLevel) {
550  $status = new Status\WarningStatus();
551  $status->setTitle('PHP xdebug.max_nesting_level is low');
552  $status->setMessage(
553  'xdebug.max_nesting_level=' . $currentMaxNestingLevel . LF .
554  'This setting controls the maximum number of nested function calls to protect against' .
555  ' infinite recursion. The current value is high enough for the TYPO3 CMS core to work' .
556  ' fine, but still some extensions could raise fatal PHP errors if the setting is not' .
557  ' raised further. A value of ' . $recommendedMaxNestingLevel . ' is recommended.' . LF .
558  'xdebug.max_nesting_level=' . $recommendedMaxNestingLevel
559  );
560  } else {
561  $status = new Status\OkStatus();
562  $status->setTitle('PHP xdebug.max_nesting_level ok');
563  }
564  } else {
565  $status = new Status\OkStatus();
566  $status->setTitle('PHP xdebug extension not loaded');
567  }
568  return $status;
569  }
570 
576  protected function checkOpenSslInstalled() {
577  if (extension_loaded('openssl')) {
578  $testKey = @openssl_pkey_new();
579  if (is_resource($testKey)) {
580  openssl_free_key($testKey);
581  $status = new Status\OkStatus();
582  $status->setTitle('PHP OpenSSL extension installed properly');
583  } else {
584  $status = new Status\ErrorStatus();
585  $status->setTitle('PHP OpenSSL extension not working');
586  $status->setMessage(
587  'Something went wrong while trying to create a new private key for testing.' .
588  ' Please check the integration of the PHP OpenSSL extension and if it is installed correctly.'
589  );
590  }
591  } else {
592  $status = new Status\ErrorStatus();
593  $status->setTitle('PHP OpenSSL extension not loaded');
594  $status->setMessage(
595  'OpenSSL is a PHP extension to encrypt/decrypt data between requests.' .
596  ' TYPO3 CMS requires it to be able to encrypt stored passwords to improve the security in the' .
597  ' database layer.'
598  );
599  }
600 
601  return $status;
602  }
603 
611  protected function getSuhosinLoadedStatus() {
612  if ($this->isSuhosinLoadedAndActive()) {
613  $status = new Status\OkStatus();
614  $status->setTitle('PHP suhosin extension loaded and active');
615  return $status;
616  } else {
617  throw new \BadMethodCallException('Should be called only if suhosin extension is loaded', 1422634778);
618  }
619  }
620 
626  protected function checkSuhosinRequestMaxVars() {
627  $recommendedRequestMaxVars = 400;
628  if ($this->isSuhosinLoadedAndActive()) {
629  $currentRequestMaxVars = ini_get('suhosin.request.max_vars');
630  if ($currentRequestMaxVars < $recommendedRequestMaxVars) {
631  $status = new Status\ErrorStatus();
632  $status->setTitle('PHP suhosin.request.max_vars too low');
633  $status->setMessage(
634  'suhosin.request.max_vars=' . $currentRequestMaxVars . LF .
635  'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' .
636  ' (as the install tool does). It is highly recommended to raise this' .
637  ' to at least ' . $recommendedRequestMaxVars . ':' . LF .
638  'suhosin.request.max_vars=' . $recommendedRequestMaxVars
639  );
640  } else {
641  $status = new Status\OkStatus();
642  $status->setTitle('PHP suhosin.request.max_vars ok');
643  }
644  } else {
645  $status = new Status\InfoStatus();
646  $status->setTitle('Suhosin not loaded');
647  $status->setMessage(
648  'If enabling suhosin, suhosin.request.max_vars' .
649  ' should be set to at least ' . $recommendedRequestMaxVars . ':' . LF .
650  'suhosin.request.max_vars=' . $recommendedRequestMaxVars
651  );
652  }
653  return $status;
654  }
655 
661  protected function checkSuhosinRequestMaxVarnameLength() {
662  $recommendedRequestMaxVarnameLength = 200;
663  if ($this->isSuhosinLoadedAndActive()) {
664  $currentRequestMaxVarnameLength = ini_get('suhosin.request.max_varname_length');
665  if ($currentRequestMaxVarnameLength < $recommendedRequestMaxVarnameLength) {
666  $status = new Status\ErrorStatus();
667  $status->setTitle('PHP suhosin.request.max_varname_length too low');
668  $status->setMessage(
669  'suhosin.request.max_varname_length=' . $currentRequestMaxVarnameLength . LF .
670  'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' .
671  ' (as the install tool does). It is highly recommended to raise this' .
672  ' to at least ' . $recommendedRequestMaxVarnameLength . ':' . LF .
673  'suhosin.request.max_varname_length=' . $recommendedRequestMaxVarnameLength
674  );
675  } else {
676  $status = new Status\OkStatus();
677  $status->setTitle('PHP suhosin.request.max_varname_length ok');
678  }
679  } else {
680  $status = new Status\InfoStatus();
681  $status->setTitle('Suhosin not loaded');
682  $status->setMessage(
683  'If enabling suhosin, suhosin.request.max_varname_length' .
684  ' should be set to at least ' . $recommendedRequestMaxVarnameLength . ':' . LF .
685  'suhosin.request.max_varname_length=' . $recommendedRequestMaxVarnameLength
686  );
687  }
688  return $status;
689  }
690 
696  protected function checkSuhosinPostMaxNameLength() {
697  $recommendedPostMaxNameLength = 200;
698  if ($this->isSuhosinLoadedAndActive()) {
699  $currentPostMaxNameLength = ini_get('suhosin.post.max_name_length');
700  if ($currentPostMaxNameLength < $recommendedPostMaxNameLength) {
701  $status = new Status\ErrorStatus();
702  $status->setTitle('PHP suhosin.post.max_name_length too low');
703  $status->setMessage(
704  'suhosin.post.max_name_length=' . $currentPostMaxNameLength . LF .
705  'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' .
706  ' (as the install tool does). It is highly recommended to raise this' .
707  ' to at least ' . $recommendedPostMaxNameLength . ':' . LF .
708  'suhosin.post.max_name_length=' . $recommendedPostMaxNameLength
709  );
710  } else {
711  $status = new Status\OkStatus();
712  $status->setTitle('PHP suhosin.post.max_name_length ok');
713  }
714  } else {
715  $status = new Status\InfoStatus();
716  $status->setTitle('Suhosin not loaded');
717  $status->setMessage(
718  'If enabling suhosin, suhosin.post.max_name_length' .
719  ' should be set to at least ' . $recommendedPostMaxNameLength . ':' . LF .
720  'suhosin.post.max_name_length=' . $recommendedPostMaxNameLength
721  );
722  }
723  return $status;
724  }
725 
731  protected function checkSuhosinPostMaxVars() {
732  $recommendedPostMaxVars = 400;
733  if ($this->isSuhosinLoadedAndActive()) {
734  $currentPostMaxVars = ini_get('suhosin.post.max_vars');
735  if ($currentPostMaxVars < $recommendedPostMaxVars) {
736  $status = new Status\ErrorStatus();
737  $status->setTitle('PHP suhosin.post.max_vars too low');
738  $status->setMessage(
739  'suhosin.post.max_vars=' . $currentPostMaxVars . LF .
740  'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' .
741  ' (as the install tool does). It is highly recommended to raise this' .
742  ' to at least ' . $recommendedPostMaxVars . ':' . LF .
743  'suhosin.post.max_vars=' . $recommendedPostMaxVars
744  );
745  } else {
746  $status = new Status\OkStatus();
747  $status->setTitle('PHP suhosin.post.max_vars ok');
748  }
749  } else {
750  $status = new Status\InfoStatus();
751  $status->setTitle('Suhosin not loaded');
752  $status->setMessage(
753  'If enabling suhosin, suhosin.post.max_vars' .
754  ' should be set to at least ' . $recommendedPostMaxVars . ':' . LF .
755  'suhosin.post.max_vars=' . $recommendedPostMaxVars
756  );
757  }
758  return $status;
759  }
760 
766  protected function checkSuhosinGetMaxValueLength() {
767  $recommendedGetMaxValueLength = 2000;
768  if ($this->isSuhosinLoadedAndActive()) {
769  $currentGetMaxValueLength = ini_get('suhosin.get.max_value_length');
770  if ($currentGetMaxValueLength < $recommendedGetMaxValueLength) {
771  $status = new Status\ErrorStatus();
772  $status->setTitle('PHP suhosin.get.max_value_length too low');
773  $status->setMessage(
774  'suhosin.get.max_value_length=' . $currentGetMaxValueLength . LF .
775  'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' .
776  ' (as the install tool does). It is highly recommended to raise this' .
777  ' to at least ' . $recommendedGetMaxValueLength . ':' . LF .
778  'suhosin.get.max_value_length=' . $recommendedGetMaxValueLength
779  );
780  } else {
781  $status = new Status\OkStatus();
782  $status->setTitle('PHP suhosin.get.max_value_length ok');
783  }
784  } else {
785  $status = new Status\InfoStatus();
786  $status->setTitle('Suhosin not loaded');
787  $status->setMessage(
788  'If enabling suhosin, suhosin.get.max_value_length' .
789  ' should be set to at least ' . $recommendedGetMaxValueLength . ':' . LF .
790  'suhosin.get.max_value_length=' . $recommendedGetMaxValueLength
791  );
792  }
793  return $status;
794  }
795 
801  protected function checkSuhosinGetMaxNameLength() {
802  $recommendedGetMaxNameLength = 200;
803  if ($this->isSuhosinLoadedAndActive()) {
804  $currentGetMaxNameLength = ini_get('suhosin.get.max_name_length');
805  if ($currentGetMaxNameLength < $recommendedGetMaxNameLength) {
806  $status = new Status\ErrorStatus();
807  $status->setTitle('PHP suhosin.get.max_name_length too low');
808  $status->setMessage(
809  'suhosin.get.max_name_length=' . $currentGetMaxNameLength . LF .
810  'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' .
811  ' (as the install tool does). It is highly recommended to raise this' .
812  ' to at least ' . $recommendedGetMaxNameLength . ':' . LF .
813  'suhosin.get.max_name_length=' . $recommendedGetMaxNameLength
814  );
815  } else {
816  $status = new Status\OkStatus();
817  $status->setTitle('PHP suhosin.get.max_name_length ok');
818  }
819  } else {
820  $status = new Status\InfoStatus();
821  $status->setTitle('Suhosin not loaded');
822  $status->setMessage(
823  'If enabling suhosin, suhosin.get.max_name_length' .
824  ' should be set to at least ' . $recommendedGetMaxNameLength . ':' . LF .
825  'suhosin.get.max_name_length=' . $recommendedGetMaxNameLength
826  );
827  }
828  return $status;
829  }
830 
837  if ($this->isSuhosinLoadedAndActive()) {
838  $whitelist = (string)ini_get('suhosin.executor.include.whitelist');
839  if (strpos($whitelist, 'phar') === FALSE) {
840  $status = new Status\NoticeStatus();
841  $status->setTitle('PHP suhosin.executor.include.whitelist does not contain phar');
842  $status->setMessage(
843  'suhosin.executor.include.whitelist= ' . $whitelist . LF .
844  '"phar" is currently not a hard requirement of TYPO3 CMS but is nice to have and a possible' .
845  ' requirement in future versions. A useful setting is:' . LF .
846  'suhosin.executor.include.whitelist=phar,vfs'
847  );
848  } else {
849  $status = new Status\OkStatus();
850  $status->setTitle('PHP suhosin.executor.include.whitelist contains phar');
851  }
852  } else {
853  $status = new Status\InfoStatus();
854  $status->setTitle('Suhosin not loaded');
855  $status->setMessage(
856  'If enabling suhosin, a useful setting is:' . LF .
857  'suhosin.executor.include.whitelist=phar,vfs'
858  );
859  }
860  return $status;
861  }
862 
869  if ($this->isSuhosinLoadedAndActive()) {
870  $whitelist = (string)ini_get('suhosin.executor.include.whitelist');
871  if (strpos($whitelist, 'vfs') === FALSE) {
872  $status = new Status\WarningStatus();
873  $status->setTitle('PHP suhosin.executor.include.whitelist does not contain vfs');
874  $status->setMessage(
875  'suhosin.executor.include.whitelist= ' . $whitelist . LF .
876  '"vfs" is currently not a hard requirement of TYPO3 CMS but tons of unit tests rely on it.' .
877  ' Furthermore, vfs will likely be a base for an additional compatibility layer in the future.' .
878  ' A useful setting is:' . LF .
879  'suhosin.executor.include.whitelist=phar,vfs'
880  );
881  } else {
882  $status = new Status\OkStatus();
883  $status->setTitle('PHP suhosin.executor.include.whitelist contains vfs');
884  }
885  } else {
886  $status = new Status\InfoStatus();
887  $status->setTitle('Suhosin not loaded');
888  $status->setMessage(
889  'If enabling suhosin, a useful setting is:' . LF .
890  'suhosin.executor.include.whitelist=phar,vfs'
891  );
892  }
893  return $status;
894  }
895 
901  protected function checkSomePhpOpcodeCacheIsLoaded() {
902  // Link to our wiki page, so we can update opcode cache issue information independent of TYPO3 CMS releases.
903  $wikiLink = 'For more information take a look in our wiki ' . TYPO3_URL_WIKI_OPCODECACHE . '.';
905  if (count($opcodeCaches) === 0) {
906  // Set status to notice. It needs to be notice so email won't be triggered.
907  $status = new Status\NoticeStatus();
908  $status->setTitle('No PHP opcode cache loaded');
909  $status->setMessage(
910  'PHP opcode caches hold a compiled version of executed PHP scripts in' .
911  ' memory and do not require to recompile a script each time it is accessed.' .
912  ' This can be a massive performance improvement and can reduce the load on a' .
913  ' server in general. A parse time reduction by factor three for fully cached' .
914  ' pages can be achieved easily if using an opcode cache.' .
915  LF . $wikiLink
916  );
917  } else {
918  $status = new Status\OkStatus();
919  $message = '';
920 
921  foreach ($opcodeCaches as $opcodeCache => $properties) {
922  $message .= 'Name: ' . $opcodeCache . ' Version: ' . $properties['version'];
923  $message .= LF;
924 
925  if ($properties['error']) {
926  // Set status to error if not already set
927  if ($status->getSeverity() !== 'error') {
928  $status = new Status\ErrorStatus();
929  }
930  $message .= ' This opcode cache is marked as malfunctioning by the TYPO3 CMS Team.';
931  } elseif ($properties['canInvalidate']) {
932  $message .= ' This opcode cache should work correctly and has good performance.';
933  } else {
934  // Set status to notice if not already error set. It needs to be notice so email won't be triggered.
935  if ($status->getSeverity() !== 'error' || $status->getSeverity() !== 'warning') {
936  $status = new Status\NoticeStatus();
937  }
938  $message .= ' This opcode cache may work correctly but has medium performance.';
939  }
940  $message .= LF;
941  }
942 
943  $message .= $wikiLink;
944 
945  // Set title of status depending on serverity
946  switch ($status->getSeverity()) {
947  case 'error':
948  $status->setTitle('A possibly malfunctioning PHP opcode cache is loaded');
949  break;
950  case 'warning':
951  $status->setTitle('A PHP opcode cache is loaded which may cause problems');
952  break;
953  case 'ok':
954  default:
955  $status->setTitle('A PHP opcode cache is loaded');
956  break;
957  }
958  $status->setMessage($message);
959  }
960  return $status;
961  }
962 
968  protected function checkReflectionDocComment() {
969  $testReflection = new \ReflectionMethod(get_class($this), __FUNCTION__);
970  if ($testReflection->getDocComment() === FALSE) {
971  $status = new Status\AlertStatus();
972  $status->setTitle('PHP Doc comment reflection broken');
973  $status->setMessage(
974  'TYPO3 CMS core extensions like extbase and fluid heavily rely on method'
975  . ' comment parsing to fetch annotations and add magic belonging to them.'
976  . ' This does not work in the current environment and so we cannot install'
977  . ' TYPO3 CMS.' . LF
978  . ' Here are some possibilities: ' . LF
979  . '* In Zend OPcache you can disable saving/loading comments. If you are using'
980  . ' Zend OPcache (included since PHP 5.5) then check your php.ini settings for'
981  . ' opcache.save_comments and opcache.load_comments and enable them.' . LF
982  . '* In Zend Optimizer+ you can disable saving comments. If you are using'
983  . ' Zend Optimizer+ then check your php.ini settings for'
984  . ' zend_optimizerplus.save_comments and enable it.' . LF
985  . '* The PHP extension eaccelerator is known to break this if'
986  . ' it is compiled without --with-eaccelerator-doc-comment-inclusion flag.'
987  . ' This compile flag must be specified, otherwise TYPO3 CMS will not work.' . LF
988  . 'For more information take a look in our wiki ' . TYPO3_URL_WIKI_OPCODECACHE . '.'
989  );
990  } else {
991  $status = new Status\OkStatus();
992  $status->setTitle('PHP Doc comment reflection works');
993  }
994  return $status;
995  }
996 
1002  protected function checkSystemLocale() {
1003 
1004  $currentLocale = setlocale(LC_CTYPE, 0);
1005 
1006  // On Windows an empty locale value uses the regional settings from the Control Panel
1007  if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] === '' && TYPO3_OS !== 'WIN') {
1008  $status = new Status\InfoStatus();
1009  $status->setTitle('Empty systemLocale setting');
1010  $status->setMessage(
1011  '$GLOBALS[TYPO3_CONF_VARS][SYS][systemLocale] is not set. This is fine as long as no UTF-8' .
1012  ' file system is used.'
1013  );
1014  } elseif (setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']) === FALSE) {
1015  $status = new Status\ErrorStatus();
1016  $status->setTitle('Incorrect systemLocale setting');
1017  $status->setMessage(
1018  'Current value of the $GLOBALS[TYPO3_CONF_VARS][SYS][systemLocale] is incorrect. A locale with' .
1019  ' this name doesn\'t exist in the operating system.'
1020  );
1021  setlocale(LC_CTYPE, $currentLocale);
1022  } else {
1023  $status = new Status\OkStatus();
1024  $status->setTitle('System locale is correct');
1025  }
1026 
1027  return $status;
1028  }
1029 
1036  protected function checkLocaleWithUTF8filesystem() {
1037 
1038  if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
1039 
1040  // On Windows an empty local value uses the regional settings from the Control Panel
1041  if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] === '' && TYPO3_OS !== 'WIN') {
1042  $status = new Status\ErrorStatus();
1043  $status->setTitle('System locale not set on UTF-8 file system');
1044  $status->setMessage(
1045  '$GLOBALS[TYPO3_CONF_VARS][SYS][UTF8filesystem] is set, but $GLOBALS[TYPO3_CONF_VARS][SYS][systemLocale]' .
1046  ' is empty. Make sure a valid locale which supports UTF-8 is set.'
1047  );
1048  } else {
1049  $testString = 'ÖöĄĆŻĘĆćążąęó.jpg';
1050  $currentLocale = setlocale(LC_CTYPE, 0);
1051  $quote = TYPO3_OS === 'WIN' ? '"' : '\'';
1052 
1053  setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);
1054 
1055  if (escapeshellarg($testString) === $quote . $testString . $quote) {
1056  $status = new Status\OkStatus();
1057  $status->setTitle('File names with UTF-8 characters can be used.');
1058  } else {
1059  $status = new Status\ErrorStatus();
1060  $status->setTitle('System locale setting doesn\'t support UTF-8 file names.');
1061  $status->setMessage(
1062  'Please check your $GLOBALS[TYPO3_CONF_VARS][SYS][systemLocale] setting.'
1063  );
1064  }
1065 
1066  setlocale(LC_CTYPE, $currentLocale);
1067  }
1068 
1069 
1070  } else {
1071  $status = new Status\OkStatus();
1072  $status->setTitle('Skipping test, as UTF8filesystem is not enabled.');
1073  }
1074 
1075  return $status;
1076  }
1077 
1083  protected function checkWindowsApacheThreadStackSize() {
1084  if (
1085  $this->isWindowsOs()
1086  && substr($_SERVER['SERVER_SOFTWARE'], 0, 6) === 'Apache'
1087  ) {
1088  $status = new Status\WarningStatus();
1089  $status->setTitle('Windows apache thread stack size');
1090  $status->setMessage(
1091  'This current value cannot be checked by the system, so please ignore this warning if it' .
1092  ' is already taken care of: Fluid uses complex regular expressions which require a lot' .
1093  ' of stack space during the first processing.' .
1094  ' On Windows the default stack size for Apache is a lot smaller than on UNIX.' .
1095  ' You can increase the size to 8MB (default on UNIX) by adding the following configuration' .
1096  ' to httpd.conf and restarting Apache afterwards:' . LF .
1097  '<IfModule mpm_winnt_module>' . LF .
1098  'ThreadStackSize 8388608' . LF .
1099  '</IfModule>'
1100  );
1101  } else {
1102  $status = new Status\OkStatus();
1103  $status->setTitle('Apache ThreadStackSize is not an issue on UNIX systems');
1104  }
1105  return $status;
1106  }
1107 
1114  protected function checkRequiredPhpExtension($extension) {
1115  if (!extension_loaded($extension)) {
1116  $status = new Status\ErrorStatus();
1117  $status->setTitle('PHP extension ' . $extension . ' not loaded');
1118  $status->setMessage(
1119  'TYPO3 CMS uses PHP extension ' . $extension . ' but it is not loaded' .
1120  ' in your environment. Change your environment to provide this extension.'
1121  );
1122  } else {
1123  $status = new Status\OkStatus();
1124  $status->setTitle('PHP extension ' . $extension . ' loaded');
1125  }
1126  return $status;
1127  }
1128 
1134  protected function checkGdLibTrueColorSupport() {
1135  if (function_exists('imagecreatetruecolor')) {
1136  $imageResource = @imagecreatetruecolor(50, 100);
1137  if (is_resource($imageResource)) {
1138  imagedestroy($imageResource);
1139  $status = new Status\OkStatus();
1140  $status->setTitle('PHP GD library true color works');
1141  } else {
1142  $status = new Status\ErrorStatus();
1143  $status->setTitle('PHP GD library true color support broken');
1144  $status->setMessage(
1145  'GD is loaded, but calling imagecreatetruecolor() fails.' .
1146  ' This must be fixed, TYPO3 CMS won\'t work well otherwise.'
1147  );
1148  }
1149  } else {
1150  $status = new Status\ErrorStatus();
1151  $status->setTitle('PHP GD library true color support missing');
1152  $status->setMessage(
1153  'Gdlib is essential for TYPO3 CMS to work properly.'
1154  );
1155  }
1156  return $status;
1157  }
1158 
1164  protected function checkGdLibGifSupport() {
1165  if (
1166  function_exists('imagecreatefromgif')
1167  && function_exists('imagegif')
1168  && (imagetypes() & IMG_GIF)
1169  ) {
1170  $imageResource = @imagecreatefromgif(__DIR__ . '/../../Resources/Public/Images/TestInput/Test.gif');
1171  if (is_resource($imageResource)) {
1172  imagedestroy($imageResource);
1173  $status = new Status\OkStatus();
1174  $status->setTitle('PHP GD library has gif support');
1175  } else {
1176  $status = new Status\ErrorStatus();
1177  $status->setTitle('PHP GD library gif support broken');
1178  $status->setMessage(
1179  'GD is loaded, but calling imagecreatefromgif() fails.' .
1180  ' This must be fixed, TYPO3 CMS won\'t work well otherwise.'
1181  );
1182  }
1183  } else {
1184  $status = new Status\ErrorStatus();
1185  $status->setTitle('PHP GD library gif support missing');
1186  $status->setMessage(
1187  'GD must be compiled with gif support. This is essential for' .
1188  ' TYPO3 CMS to work properly.'
1189  );
1190  }
1191  return $status;
1192  }
1193 
1199  protected function checkGdLibJpgSupport() {
1200  if (
1201  function_exists('imagecreatefromjpeg')
1202  && function_exists('imagejpeg')
1203  && (imagetypes() & IMG_JPG)
1204  ) {
1205  $status = new Status\OkStatus();
1206  $status->setTitle('PHP GD library has jpg support');
1207  } else {
1208  $status = new Status\ErrorStatus();
1209  $status->setTitle('PHP GD library jpg support missing');
1210  $status->setMessage(
1211  'GD must be compiled with jpg support. This is essential for' .
1212  ' TYPO3 CMS to work properly.'
1213  );
1214  }
1215  return $status;
1216  }
1217 
1223  protected function checkGdLibPngSupport() {
1224  if (
1225  function_exists('imagecreatefrompng')
1226  && function_exists('imagepng')
1227  && (imagetypes() & IMG_PNG)
1228  ) {
1229  $imageResource = @imagecreatefrompng(__DIR__ . '/../../Resources/Public/Images/TestInput/Test.png');
1230  if (is_resource($imageResource)) {
1231  imagedestroy($imageResource);
1232  $status = new Status\OkStatus();
1233  $status->setTitle('PHP GD library has png support');
1234  } else {
1235  $status = new Status\ErrorStatus();
1236  $status->setTitle('PHP GD library png support broken');
1237  $status->setMessage(
1238  'GD is compiled with png support, but calling imagecreatefrompng() fails.' .
1239  ' Check your environment and fix it, png in GD lib is important' .
1240  ' for TYPO3 CMS to work properly.'
1241  );
1242  }
1243  } else {
1244  $status = new Status\ErrorStatus();
1245  $status->setTitle('PHP GD library png support missing');
1246  $status->setMessage(
1247  'GD must be compiled with png support. This is essential for' .
1248  ' TYPO3 CMS to work properly'
1249  );
1250  }
1251  return $status;
1252  }
1253 
1259  protected function checkGdLibFreeTypeSupport() {
1260  if (function_exists('imagettftext')) {
1261  $status = new Status\OkStatus();
1262  $status->setTitle('PHP GD library has freetype font support');
1263  $status->setMessage(
1264  'There is a difference between the font size setting which the GD' .
1265  ' library should be supplied with. If installation is completed' .
1266  ' a test in the install tool helps to find out the value you need.'
1267  );
1268  } else {
1269  $status = new Status\ErrorStatus();
1270  $status->setTitle('PHP GD library freetype support missing');
1271  $status->setMessage(
1272  'Some core functionality and extension rely on the GD' .
1273  ' to render fonts on images. This support is missing' .
1274  ' in your environment. Install it.'
1275  );
1276  }
1277  return $status;
1278  }
1279 
1285  protected function isTrueTypeFontDpiStandard() {
1286  if (function_exists('imageftbbox')) {
1287  // 20 Pixels at 96 DPI - the DefaultConfiguration
1288  $fontSize = (20 / 96 * 72);
1289  $textDimensions = @imageftbbox(
1290  $fontSize,
1291  0,
1292  __DIR__ . '/../../Resources/Private/Font/vera.ttf',
1293  'Testing true type support'
1294  );
1295  $fontBoxWidth = $textDimensions[2] - $textDimensions[0];
1296  if ($fontBoxWidth < 300 && $fontBoxWidth > 200) {
1297  $status = new Status\OkStatus();
1298  $status->setTitle('FreeType True Type Font DPI');
1299  $status->setMessage('Fonts are rendered by FreeType library. ' .
1300  'We need to ensure that the final dimensions are as expected. ' .
1301  'This server renderes fonts based on 96 DPI correctly'
1302  );
1303  } else {
1304  $status = new Status\NoticeStatus();
1305  $status->setTitle('FreeType True Type Font DPI');
1306  $status->setMessage('Fonts are rendered by FreeType library. ' .
1307  'This server does not render fonts as expected. ' .
1308  'Please configure FreeType or TYPO3_CONF_VARS[GFX][TTFdpi]'
1309  );
1310  }
1311  } else {
1312  $status = new Status\ErrorStatus();
1313  $status->setTitle('PHP GD library freetype2 support missing');
1314  $status->setMessage(
1315  'The core relies on GD library compiled into PHP with freetype2' .
1316  ' support. This is missing on your system. Please install it.'
1317  );
1318  }
1319 
1320  return $status;
1321  }
1322 
1328  protected function checkPhpMagicQuotes() {
1329  $magicQuotesGpc = get_magic_quotes_gpc();
1330  if ($magicQuotesGpc) {
1331  $status = new Status\WarningStatus();
1332  $status->setTitle('PHP magic quotes on');
1333  $status->setMessage(
1334  'magic_quotes_gpc=' . $magicQuotesGpc . LF .
1335  'Setting magic_quotes_gpc is deprecated since PHP 5.3.' .
1336  ' You are advised to disable it until it is completely removed:' . LF .
1337  'magic_quotes_gpc=Off'
1338  );
1339  } else {
1340  $status = new Status\OkStatus();
1341  $status->setTitle('PHP magic quotes off');
1342  }
1343  return $status;
1344  }
1345 
1351  protected function checkRegisterGlobals() {
1352  $registerGlobalsEnabled = filter_var(
1353  ini_get('register_globals'),
1354  FILTER_VALIDATE_BOOLEAN,
1355  array(FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE)
1356  );
1357  if ($registerGlobalsEnabled === TRUE) {
1358  $status = new Status\ErrorStatus();
1359  $status->setTitle('PHP register globals on');
1360  $status->setMessage(
1361  'register_globals=' . ini_get('register_globals') . LF .
1362  'TYPO3 requires PHP setting "register_globals" set to off.' .
1363  ' This ancient PHP setting is a big security problem and should' .
1364  ' never be enabled:' . LF .
1365  'register_globals=Off'
1366  );
1367  } else {
1368  $status = new Status\OkStatus();
1369  $status->setTitle('PHP register globals off');
1370  }
1371  return $status;
1372  }
1373 
1379  protected function checkLibXmlBug() {
1380  $sampleArray = array('Test>><<Data');
1381 
1382  $xmlContent = '<numIndex index="0">Test&gt;&gt;&lt;&lt;Data</numIndex>' . LF;
1383 
1384  $xml = \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml($sampleArray, '', -1);
1385 
1386  if ($xmlContent !== $xml) {
1387  $status = new Status\ErrorStatus();
1388  $status->setTitle('PHP libxml bug present');
1389  $status->setMessage(
1390  'Some hosts have problems saving ">><<" in a flexform.' .
1391  ' To fix this, enable [BE][flexformForceCDATA] in' .
1392  ' All Configuration.'
1393  );
1394  } else {
1395  $status = new Status\OkStatus();
1396  $status->setTitle('PHP libxml bug not present');
1397  }
1398  return $status;
1399  }
1400 
1411  protected function isValidIp($ip) {
1412  return filter_var($ip, FILTER_VALIDATE_IP) !== FALSE;
1413  }
1414 
1420  protected function isWindowsOs() {
1421  $windowsOs = FALSE;
1422  if (!stristr(PHP_OS, 'darwin') && stristr(PHP_OS, 'win')) {
1423  $windowsOs = TRUE;
1424  }
1425  return $windowsOs;
1426  }
1427 
1433  protected function isSuhosinLoadedAndActive() {
1434  $suhosinLoaded = FALSE;
1435  if (extension_loaded('suhosin')) {
1436  $suhosinInSimulationMode = filter_var(
1437  ini_get('suhosin.simulation'),
1438  FILTER_VALIDATE_BOOLEAN,
1439  array(FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE)
1440  );
1441  if (!$suhosinInSimulationMode) {
1442  $suhosinLoaded = TRUE;
1443  }
1444  }
1445  return $suhosinLoaded;
1446  }
1447 
1456  protected function trimExplode($delimiter, $string) {
1457  $explodedValues = explode($delimiter, $string);
1458  $resultWithPossibleEmptyValues = array_map('trim', $explodedValues);
1459  $result = array();
1460  foreach ($resultWithPossibleEmptyValues as $value) {
1461  if ($value !== '') {
1462  $result[] = $value;
1463  }
1464  }
1465  return $result;
1466  }
1467 
1474  protected function getBytesFromSizeMeasurement($measurement) {
1475  $bytes = doubleval($measurement);
1476  if (stripos($measurement, 'G')) {
1477  $bytes *= 1024 * 1024 * 1024;
1478  } elseif (stripos($measurement, 'M')) {
1479  $bytes *= 1024 * 1024;
1480  } elseif (stripos($measurement, 'K')) {
1481  $bytes *= 1024;
1482  }
1483  return (int)$bytes;
1484  }
1485 
1486 }
static array2xml(array $array, $NSprefix='', $level=0, $docTag='phparray', $spaceInd=0, array $options=array(), array $stackData=array())
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]