Skip to content

Commit 182eed3

Browse files
committed
Validate data for developers because they won't
1 parent 9b7fe12 commit 182eed3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Format/Json.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public function stringToObject($data, array $options = array('processSections' =
5959
{
6060
$data = trim($data);
6161

62+
// Because developers are clearly not validating their data before pushing it into a Registry, we'll do it for them
63+
if (empty($data))
64+
{
65+
return new \stdClass;
66+
}
67+
6268
if ($data !== '' && $data[0] !== '{')
6369
{
6470
return AbstractRegistryFormat::getInstance('Ini')->stringToObject($data, $options);

0 commit comments

Comments
 (0)