1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-06 14:16: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

@@ -40,7 +40,8 @@ class HTMLPurifier_ConfigSchema_Validator
$this->validateNamespace($namespace);
}
foreach ($interchange->directives as $i => $directive) {
if ($i != "{$directive->id}") $this->error(false, "Integrity violation: key '$i' does not match internal id '{$directive->id}'");
$id = $directive->id->toString();
if ($i != $id) $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'");
$this->validateDirective($directive);
}
}
@@ -57,7 +58,8 @@ class HTMLPurifier_ConfigSchema_Validator
}
public function validateId($id) {
$this->context[] = "id '$id'";
$id_string = $id->toString();
$this->context[] = "id '$id_string'";
if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
// handled by InterchangeBuilder
$this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
@@ -72,7 +74,8 @@ class HTMLPurifier_ConfigSchema_Validator
}
public function validateDirective($d) {
$this->context[] = "directive '{$d->id}'";
$id = $d->id->toString();
$this->context[] = "directive '$id'";
$this->validateId($d->id);
$this->with($d, 'description')
->assertNotEmpty();