diff --git a/.htaccess b/.htaccess index fd7bd29..856fd32 100644 --- a/.htaccess +++ b/.htaccess @@ -39,6 +39,14 @@ AddEncoding gzip svgz php_value mbstring.http_input pass php_value mbstring.http_output pass php_flag mbstring.encoding_translation off + + # Assertions. + # By default PHP has these turned on. Production sites should turn these off. + # While assertions can be turned off at run time, we need to have this setting + # in place immediately to catch an assertions thrown before the settings file + # can be loaded. + php_value assert.active 1 + # To enable them, change 0 to 1. Recommended for dev sites. # Requires mod_expires to be enabled. diff --git a/core/lib/Drupal/Component/Fault/Assertion.php b/core/lib/Drupal/Component/Fault/Assertion.php new file mode 100644 index 0000000..51e0fe9 --- /dev/null +++ b/core/lib/Drupal/Component/Fault/Assertion.php @@ -0,0 +1,132 @@ +errorLocation['line'] + . ' in file ' + . $this->errorLocation['file'] + . ' -- asserted: ' + . $this->code + . ' -- comment: ' . $this->message; + } + + /** + * Implements BaseFaultHandler::verboseResponse. + */ + protected function verboseResponse() { + $this->printHtmlStart(); ?> + +
+Assertion: code; ?>
+ + WARNING: The Assert statement was passed a non-string + value. Whatever expression was sent to it will be evaluated regardless of + whether assert functions are turned on or off. In order to preserve system + efficiency it is imperative that you encapsulate the expression in a string + to be evaluated by assert rather than passing an expression to it. + +Comment: message; ?>
+ reference['error']) : +?> +Reference: reference['error'] ?>
+ +File: errorLocation['file']; ?>
+Line: errorLocation['line']; ?>
+ errorLocation['class']) : +?> +Class: + + errorLocation['class']; ?> + +
+Method: + + errorLocation['method']; ?> + +
+ errorLocation['method']) : +?> +Function: + + errorLocation['method'] ?> + +
+ +Global Scope
+ +