Skip to content

Commit

Permalink
Validate data for developers because they won't
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Jun 6, 2018
1 parent 9b7fe12 commit 182eed3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Format/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public function stringToObject($data, array $options = array('processSections' =
{
$data = trim($data);

// Because developers are clearly not validating their data before pushing it into a Registry, we'll do it for them
if (empty($data))
{
return new \stdClass;
}

if ($data !== '' && $data[0] !== '{')
{
return AbstractRegistryFormat::getInstance('Ini')->stringToObject($data, $options);
Expand Down

0 comments on commit 182eed3

Please sign in to comment.