Skip to content

Commit

Permalink
[fix] Error decoding JSON data: Syntax error (#20663)
Browse files Browse the repository at this point in the history
* [fix] Error decoding JSON data: Syntax error

* [test] ensure that empty params do not cause user loading issues
  • Loading branch information
phproberto authored and Michael Babker committed Jun 5, 2018
1 parent cfa9bce commit 7e938bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libraries/src/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,10 @@ public function load($id)
* user parameters, but for right now we'll leave it how it is.
*/

$this->_params->loadString($table->params);
if ($table->params)
{
$this->_params->loadString($table->params);
}

// Assuming all is well at this point let's bind the data
$this->setProperties($table->getProperties());
Expand Down
1 change: 1 addition & 0 deletions tests/unit/stubs/database/jos_users.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
'44','Manager','manager','manager@example.com','b69eafa62e549e5fa875e127fadc3c83:VapLaQZx00iYDRwgMjgsfyIHgoe01DK8','0','1','2010-02-13 00:34:42','2010-02-13 00:34:42','0','{}','0000-00-00 00:00:00','0'
'99','Test','test','test@example.com','b69eafa62e549e5fa875e127fadc3c83:VapLaQZx00iYDRwgMjgsfyIHgoe01DK8','0','1','2010-02-13 00:34:42','2010-02-13 00:34:42','0','{}','0000-00-00 00:00:00','0'
'100','Activate','activate','activate@example.com','b69eafa62e549e5fa875e127fadc3c83:VapLaQZx00iYDRwgMjgsfyIHgoe01DK8','1','1','2010-02-13 00:34:42','0000-00-00 00:00:00','30cc6de70fb18231196a28dd83363d57','{}','0000-00-00 00:00:00','0'
'101','Empty params','empty-params','empty-params@example.com','b69eafa62e549e5fa875e127fadc3c83:VapLaQZx00iYDRwgMjgsfyIHgoe01DK8','1','1','2010-02-13 00:34:42','0000-00-00 00:00:00','30cc6de70fb18231196a28dd83363d57','','0000-00-00 00:00:00','0'
5 changes: 5 additions & 0 deletions tests/unit/suites/libraries/joomla/user/JUserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ public function casesLoad()
true,
false
),
'empty-params' => array(
101,
true,
false
),
'existing-but-guest' => array(
0,
false,
Expand Down

0 comments on commit 7e938bc

Please sign in to comment.