Skip to content

Commit

Permalink
Dev: Remove faulty Hungarian notation for string argument
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Mar 28, 2023
1 parent f3c3dc9 commit 8641da0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4714,25 +4714,25 @@ function getMaximumFileUploadSize()
/**
* Decodes token attribute data because due to bugs in the past it can be written in JSON or be serialized - future format should be JSON as serialized data can be exploited
*
* @param string $oTokenAttributeData The original token attributes as stored in the database
* @param string $tokenAttributeData The original token attributes as stored in the database
* @return array|mixed
*/
function decodeTokenAttributes($oTokenAttributeData)
function decodeTokenAttributes(string $tokenAttributeData)
{
if (trim((string)$oTokenAttributeData) == '') {
if (trim($tokenAttributeData) == '') {
return array();
}
if (substr($oTokenAttributeData, 0, 1) != '{' && substr($oTokenAttributeData, 0, 1) != '[') {
$sSerialType = getSerialClass($oTokenAttributeData);
if (substr($tokenAttributeData, 0, 1) != '{' && substr($tokenAttributeData, 0, 1) != '[') {
$sSerialType = getSerialClass($tokenAttributeData);
if ($sSerialType == 'array') {
// Safe to decode
$aReturnData = @unserialize($oTokenAttributeData);
$aReturnData = unserialize($tokenAttributeData) ?? [];
} else {
// Something else, might be unsafe
return array();
}
} else {
$aReturnData = @json_decode($oTokenAttributeData, true);
$aReturnData = json_decode($tokenAttributeData, true) ?? [];
}
if ($aReturnData === false || $aReturnData === null) {
return array();
Expand Down

0 comments on commit 8641da0

Please sign in to comment.