Project

General

Profile

Actions

Feature #63960

closed

Use of pageNotFoundAndExit is better than simple "die"

Added by Christian Finkemeier over 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2014-12-17
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
easy
Sprint Focus:

Description

There are several die calls in the tslib_fe class, e.g. in the jumpurl section. For a better usability this calls should be replaced by calling the pageNotFoundAndExit method, in order to display a correct error page.

File typo3/sysext/cms/tslib/class.tslib_fe.php:

line 1779-1781
-            } else die(htmlspecialchars('Request URL did not match "'.t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.$inputCode.'"'));    // This check is to prevent people from setting additional GET vars via realurl or other URL path based ways of passing parameters.
+            } else $this->pageNotFoundAndExit(htmlspecialchars('Request URL did not match "'.t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.$inputCode.'"'));    // This check is to prevent people from setting additional GET vars via realurl or other URL path based ways of passing parameters.
-        } else die('POST requests are incompatible with keyword preview.');
+        } else $this->pageNotFoundAndExit('POST requests are incompatible with keyword preview.');
-    } else die('ADMCMD command could not be executed! (No keyword configuration found)');
+    } else $this->pageNotFoundAndExit('ADMCMD command could not be executed! (No keyword configuration found)');

line 1800
-    } else die('Error in preview configuration.');
+    } else $this->pageNotFoundAndExit('Error in preview configuration.');

line 2728-2731
-                } else die('jumpurl Secure: "'.$this->jumpurl.'" was not a valid file!');
+                } else $this->pageNotFoundAndExit('jumpurl Secure: "'.$this->jumpurl.'" was not a valid file!');
-            } else die('jumpurl Secure: The requested file was not allowed to be accessed through jumpUrl (path or file not allowed)!');
+            } else $this->pageNotFoundAndExit('jumpurl Secure: The requested file was not allowed to be accessed through jumpUrl (path or file not allowed)!');
-        } else die('jumpurl Secure: locationData, '.$locationData.', was not accessible.');
+        } else $this->pageNotFoundAndExit('jumpurl Secure: locationData, '.$locationData.', was not accessible.');
-    } else die('jumpurl Secure: Calculated juHash did not match the submitted juHash.');
+    } else $this->pageNotFoundAndExit('jumpurl Secure: Calculated juHash did not match the submitted juHash.');

Actions #1

Updated by Alexander Opitz over 9 years ago

  • Status changed from New to Needs Feedback

About which TYPO3 version do you speak?

Actions #2

Updated by Riccardo De Contardi over 9 years ago

The lines reported are present in 4.5.39; as far as I can see in 4.7.19 the "die" has been replaced with "throw new Exception".

typo3/sysext/cms/tslib/class.tslib_fe.php is absent in TYPO3 CMS 6.2.9; lines similar to the ones reported can be found in:

typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

typo3/sysext/version/Classes/Hook/PreviewHook.php

in which "throw new \Exception" is used instead of "die".

Actions #3

Updated by Alexander Opitz over 9 years ago

As 4.5 is in security fixes only mode, we won't change the handling there.

The Exceptions since 4.7 aren't ok for you?

Actions #4

Updated by Riccardo De Contardi over 9 years ago

Talking for myself, I merely reported that the code has changed and the "die" is not used anymore :) I guess it can be closed, but I think there are people that can judge better than me ;)

Actions #5

Updated by Stephan Großberndt almost 9 years ago

  • Status changed from Needs Feedback to Closed

Since exceptions are thrown instead of die () statements in all supported versions as of now this issue will be closed.

Actions

Also available in: Atom PDF