Skip to content

Commit

Permalink
fix: calling htmlspecialchars_decode on null objects (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellite committed May 20, 2024
1 parent 9e8b84b commit 5050a28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions endpoints/subscription/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@

if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$subscriptionData['id'] = $subscriptionId;
$subscriptionData['name'] = htmlspecialchars_decode($row['name']);
$subscriptionData['name'] = htmlspecialchars_decode($row['name'] ?? "");
$subscriptionData['logo'] = $row['logo'];
$subscriptionData['price'] = $row['price'];
$subscriptionData['currency_id'] = $row['currency_id'];
$subscriptionData['next_payment'] = $row['next_payment'];
$subscriptionData['frequency'] = $row['frequency'];
$subscriptionData['cycle'] = $row['cycle'];
$subscriptionData['notes'] = htmlspecialchars_decode($row['notes']);
$subscriptionData['notes'] = htmlspecialchars_decode($row['notes'] ?? "");
$subscriptionData['payment_method_id'] = $row['payment_method_id'];
$subscriptionData['payer_user_id'] = $row['payer_user_id'];
$subscriptionData['category_id'] = $row['category_id'];
$subscriptionData['notify'] = $row['notify'];
$subscriptionData['inactive'] = $row['inactive'];
$subscriptionData['url'] = htmlspecialchars_decode($row['url']);
$subscriptionData['url'] = htmlspecialchars_decode($row['url'] ?? "");
$subscriptionData['notify_days_before'] = $row['notify_days_before'];

$subscriptionJson = json_encode($subscriptionData);
Expand Down
6 changes: 3 additions & 3 deletions endpoints/subscriptions/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
$id = $subscription['id'];
$print[$id]['id'] = $id;
$print[$id]['logo'] = $subscription['logo'] != "" ? "images/uploads/logos/".$subscription['logo'] : $defaultLogo;
$print[$id]['name'] = htmlspecialchars_decode($subscription['name']);
$print[$id]['name'] = htmlspecialchars_decode($subscription['name'] ?? "");
$cycle = $subscription['cycle'];
$frequency = $subscription['frequency'];
$print[$id]['billing_cycle'] = getBillingCycle($cycle, $frequency, $i18n);
Expand All @@ -92,8 +92,8 @@
$print[$id]['payer_user_id'] = $subscription['payer_user_id'];
$print[$id]['price'] = floatval($subscription['price']);
$print[$id]['inactive'] = $subscription['inactive'];
$print[$id]['url'] = htmlspecialchars_decode($subscription['url']);
$print[$id]['notes'] = htmlspecialchars_decode($subscription['notes']);
$print[$id]['url'] = htmlspecialchars_decode($subscription['url'] ?? "");
$print[$id]['notes'] = htmlspecialchars_decode($subscription['notes'] ?? "");

if (isset($settings['convertCurrency']) && $settings['convertCurrency'] === 'true' && $currencyId != $mainCurrencyId) {
$print[$id]['price'] = getPriceConverted($print[$id]['price'], $currencyId, $db);
Expand Down
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v1.29.0";
$version = "v1.29.1";
?>

0 comments on commit 5050a28

Please sign in to comment.