We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 9b461db4 authored by mattl's avatar mattl

Send the entire XMLStringer object in MagicEnvelope events.

parent 184293c6
......@@ -206,11 +206,11 @@ class MagicEnvelope
* @return string representation of XML document
public function toXML($flavour=null) {
$xml = null;
if (Event::handle('MagicEnvelopeToXML', array($this, $flavour, &$xml))) {
$xs = new XMLStringer();
$xs->startXML(); // header, to point out it's not HTML or anything...
if (Event::handle('StartMagicEnvelopeToXML', array($this, $xs, $flavour))) {
// fall back to our default, normal Magic Envelope XML.
$xs = new XMLStringer();
// the $xs element _may_ have had elements added, or could get in the end event
$xs->elementStart('me:env', array('xmlns:me' => self::NS));
$xs->element('me:data', array('type' => $this->data_type), $this->data);
$xs->element('me:encoding', null, $this->encoding);
......@@ -218,12 +218,9 @@ class MagicEnvelope
$xs->element('me:sig', null, $this->getSignature());
$xml = $xs->getString();
Event::handle('EndMagicEnvelopeToXML', array($this, $xs, $flavour));
if (is_null($xml)) {
throw new ServerException('No Magic Envelope XML string was created.');
return $xml;
return $xs->getString();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment