1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 05:07:55 +02:00

Make context errors more friendly; factor out disabled; fix broken test cases; update TODO.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1220 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-06-24 04:22:28 +00:00
parent 269268b843
commit 75e52a12a6
5 changed files with 51 additions and 37 deletions

View File

@@ -2,6 +2,8 @@
/**
* Registry object that contains information about the current context.
* @warning Is a bit buggy when variables are set to null: it thinks
* they don't exist! So use false instead, please.
*/
class HTMLPurifier_Context
{
@@ -19,7 +21,7 @@ class HTMLPurifier_Context
*/
function register($name, &$ref) {
if (isset($this->_storage[$name])) {
trigger_error('Name collision, cannot re-register',
trigger_error("Name $name produces collision, cannot re-register",
E_USER_ERROR);
return;
}
@@ -32,7 +34,7 @@ class HTMLPurifier_Context
*/
function &get($name) {
if (!isset($this->_storage[$name])) {
trigger_error('Attempted to retrieve non-existent variable',
trigger_error("Attempted to retrieve non-existent variable $name",
E_USER_ERROR);
$var = null; // so we can return by reference
return $var;
@@ -46,7 +48,7 @@ class HTMLPurifier_Context
*/
function destroy($name) {
if (!isset($this->_storage[$name])) {
trigger_error('Attempted to destroy non-existent variable',
trigger_error("Attempted to destroy non-existent variable $name",
E_USER_ERROR);
return;
}