1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-07 22:56:32 +02:00

Fix PHP 5.0 and other early version compatibility by removing use of __toString

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1629 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-03-23 02:50:42 +00:00
parent 6d517fab09
commit 7e59923029
5 changed files with 16 additions and 22 deletions

View File

@@ -43,20 +43,21 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
// These are required elements:
$directive->id = $this->id($hash->offsetGet('ID'));
$id = $directive->id->toString(); // convenience
if (isset($hash['TYPE'])) {
$type = explode('/', $hash->offsetGet('TYPE'));
if (isset($type[1])) $directive->typeAllowsNull = true;
$directive->type = $type[0];
} else {
throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '{$directive->id}' not defined");
throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined");
}
if (isset($hash['DEFAULT'])) {
try {
$directive->default = $this->varParser->parse($hash->offsetGet('DEFAULT'), $directive->type, $directive->typeAllowsNull);
} catch (HTMLPurifier_VarParserException $e) {
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in TYPE/DEFAULT in directive hash '{$directive->id}'");
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in TYPE/DEFAULT in directive hash '$id'");
}
}
@@ -79,7 +80,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
$this->varParser->parse($real, $directive->type, $directive->typeAllowsNull);
}
} catch (HTMLPurifier_VarParserException $e) {
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in $alias => $real in VALUE-ALIASES in directive hash '{$directive->id}'");
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in $alias => $real in VALUE-ALIASES in directive hash '$id'");
}
}