[BUGFIX] Send header Error 404 in case of page not found errors
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_fe.php
index 9fccf9e..1620457 100644 (file)
                                        $this->pageNotFoundAndExit('The requested page does not exist!');
                                } else {
                                        $message = 'The requested page does not exist!';
-                                       header('HTTP/1.0 404 Page Not Found');
+                                       header(t3lib_utility_Http::HTTP_STATUS_404);
                                        t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
-                                       throw new RuntimeException($message, 1294587208);
+                                       $messagePage = t3lib_div::makeInstance('t3lib_message_ErrorpageMessage', $message);
+                                       $messagePage->output();
+                                       exit;
                                }
                        }
                }
                                $this->pageNotFoundAndExit('The requested page does not exist!');
                        } else {
                                $message = 'The requested page does not exist!';
-                               header('HTTP/1.0 404 Page Not Found');
+                               header(t3lib_utility_Http::HTTP_STATUS_404);
                                t3lib_div::sysLog($message, 'cms', t3lib_div::SYSLOG_SEVERITY_ERROR);
-                               throw new RuntimeException($message, 1294587209);
+                               $messagePage = t3lib_div::makeInstance('t3lib_message_ErrorpageMessage', $message);
+                               $messagePage->output();
+                               exit;
                        }
                }
 
 
                        // Create response:
                if (gettype($code)=='boolean' || !strcmp($code,1))      {       // Simply boolean; Just shows TYPO3 error page with reason:
-                       throw new RuntimeException('The page did not exist or was inaccessible.' . ($reason ? ' Reason: ' . htmlspecialchars($reason) : ''), 1294587213);
+                       $message = 'The page did not exist or was inaccessible.' . ($reason ? ' Reason: ' . htmlspecialchars($reason) : '');
+                       $messagePage = t3lib_div::makeInstance('t3lib_message_ErrorpageMessage', $message);
+                       $messagePage->output();
+                       exit;
                } elseif (t3lib_div::isFirstPartOfStr($code,'USER_FUNCTION:')) {
                        $funcRef = trim(substr($code,14));
                        $params = array(
                                echo $content;  // Output the content
                        }
                } else {
-                       throw new RuntimeException($reason ? htmlspecialchars($reason) : 'Page cannot be found.', 1294587216);
+                       $message = ($reason ? 'Reason: ' . htmlspecialchars($reason) : 'Page cannot be found.');
+                       $messagePage = t3lib_div::makeInstance('t3lib_message_ErrorpageMessage', $message);
+                       $messagePage->output();
                }
                exit();
        }