Fix issue that caused exceptions when using sections with trailing or leading whitespaces

Trim all incoming section identifier to prevent ambiguities between parsd sections and input sections.
This commit is contained in:
Matthias Jentsch 2015-08-07 09:26:50 +02:00
parent eebd8be746
commit 308c8ccf79
1 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ class Document
*/
public function hasSection($name)
{
return isset($this->sections[$name]);
return isset($this->sections[trim($name)]);
}
/**
@ -40,7 +40,7 @@ class Document
*/
public function getSection($name)
{
return $this->sections[$name];
return $this->sections[trim($name)];
}
/**
@ -51,7 +51,7 @@ class Document
*/
public function setSection($name, Section $section)
{
return $this->sections[$name] = $section;
return $this->sections[trim($name)] = $section;
}
/**
@ -59,7 +59,7 @@ class Document
*/
public function removeSection($name)
{
unset ($this->sections[$name]);
unset ($this->sections[trim($name)]);
}
/**