Skip to content

Commit

Permalink
Fixed blank extras
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Asraf committed Nov 24, 2014
1 parent 1a19dcf commit 0c0632f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Airbrake/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Configuration extends Record
'resource' => '/notifier_api/v2/notices',
'apiEndPoint' => null,
'errorReportingLevel' => null,
'extraParams' => null,
'extraParameters' => null,
);

/** @var array */
Expand Down
12 changes: 10 additions & 2 deletions src/Airbrake/Notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ public function toXml(Configuration $configuration)
$request->addChild('action', $configuration->get('action'));

$extras = $this->get('extraParameters');
$innerExtras = array_merge($configuration->get('extraParameters'), $extras);
$configExtras = $configuration->get('extraParameters');

if (!isset($extras))
$extras = array();
if (!isset($configExtras))
$configExtras = array();

$innerExtras = array_merge($extras, $configExtras);

$params = array_merge($configuration->getParameters(), array('airbrake_extra' => $innerExtras));

$this->array2Node($request, 'params', $params);
Expand Down Expand Up @@ -99,7 +107,7 @@ protected function array2Node($parentNode, $key, $params)

// htmlspecialchars() is needed to prevent html characters from breaking the node.
$node->addChild('var', htmlspecialchars($value))
->addAttribute('key', $key);
->addAttribute('key', $key);
}
}
}

0 comments on commit 0c0632f

Please sign in to comment.